public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, Thread /*!*/ self) { RubyThreadInfo.RegisterThread(Thread.CurrentThread); MutableString result = MutableString.CreateMutable(); result.Append("#<"); result.Append(RubyUtils.GetClassName(context, self)); result.Append(':'); RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(context, self)); result.Append(' '); if ((self.ThreadState & ThreadState.WaitSleepJoin) != 0) { result.Append("sleep"); } else if ((self.ThreadState & (ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested)) != 0) { result.Append("dead"); } else { result.Append("run"); } result.Append('>'); return(result); }
public static MutableString TagUri(RubyContext /*!*/ context, object self) { MutableString str = MutableString.Create("!ruby/object:"); str.Append(RubyUtils.GetClassName(context, self)); return(str); }
public static int Limit(RubyContext /*!*/ context, RubyClass /*!*/ self, [Optional] object n) { if (!(n is Missing)) { throw RubyExceptions.CreateTypeError("wrong argument type " + RubyUtils.GetClassName(self.Context, n) + " (expected Fixnum)"); } return(GetConfig(context).Limit); }
private static RubyIO /*!*/ ToIo(RubyContext /*!*/ context, object obj) { RubyIO io = obj as RubyIO; if (io == null) { throw RubyExceptions.CreateTypeConversionError(RubyUtils.GetClassName(context, obj), "IO"); } return(io); }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, RubyEncoding /*!*/ self) { // TODO: to_s overridden MutableString result = MutableString.CreateMutable(); result.Append("#<"); result.Append(RubyUtils.GetClassName(context, self)); result.Append(':'); result.Append(self.Name); result.Append(">"); return(result); }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, Exception /*!*/ self) { object message = RubyExceptionData.GetInstance(self).Message; string className = RubyUtils.GetClassName(context, self); MutableString result = MutableString.CreateMutable(); result.Append("#<"); result.Append(className); result.Append(": "); if (message != null) { result.Append(KernelOps.Inspect(context, message)); } else { result.Append(className); } result.Append('>'); return(result); }
public static int InducedFrom(RubyClass /*!*/ self, object obj) { throw RubyExceptions.CreateTypeError(String.Format("failed to convert {0} into Integer", RubyUtils.GetClassName(self.Context, obj))); }
public static double InducedFrom(RubyClass /*!*/ self, object value) { throw RubyExceptions.CreateTypeError(String.Format("failed to convert {0} into Float", RubyUtils.GetClassName(self.Context, value))); }
public static Node ToYamlNode(RubyContext /*!*/ context, object self, RubyRepresenter rep) { throw RubyExceptions.CreateTypeError("can't dump anonymous class " + RubyUtils.GetClassName(context, self)); }
// Calls to_hash on the object, if it's not already a dictionary // (only certain Hash functions use this in Ruby) internal static IDictionary <object, object> ConvertToHash(RubyContext /*!*/ context, object hash) { try { IDictionary <object, object> dict = hash as IDictionary <object, object>; return(dict != null ? dict : RubySites.ToHash(context, hash)); } catch (MissingMethodException e) { throw new InvalidOperationException(String.Format("can't convert {0} into Hash", RubyUtils.GetClassName(context, hash)), e); } }
public static object SquareRoot(RubyContext /*!*/ context, BigDecimal /*!*/ self, object n) { throw RubyExceptions.CreateTypeError("wrong argument type " + RubyUtils.GetClassName(context, n) + " (expected Fixnum)"); }
public static BigDecimal InducedFrom(RubyClass /*!*/ self, object value) { throw RubyExceptions.CreateTypeConversionError(RubyUtils.GetClassName(self.Context, value), self.Name); }
/// <summary> /// Check that the object responds to "succ". /// </summary> private static void CheckBegin(RubyContext /*!*/ context, object begin) { if (!RubySites.RespondTo(context, begin, "succ")) { throw RubyExceptions.CreateTypeError(String.Format("can't iterate from {0}", RubyUtils.GetClassName(context, begin))); } }
public static RubyArray Coerce(RubyContext /*!*/ context, BigInteger /*!*/ self, object other) { throw RubyExceptions.CreateTypeError(String.Format("can't coerce {0} to Bignum", RubyUtils.GetClassName(context, other))); }