internal static MutableString /*!*/ ToS(RubyContext /*!*/ context, string /*!*/ methodName, RubyModule /*!*/ declaringModule, RubyModule /*!*/ targetModule, string /*!*/ classDisplayName) { MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(classDisplayName); result.Append(": "); if (ReferenceEquals(targetModule, declaringModule)) { result.Append(declaringModule.GetDisplayName(context, true)); } else { result.Append(targetModule.GetDisplayName(context, true)); result.Append('('); result.Append(declaringModule.GetDisplayName(context, true)); result.Append(')'); } result.Append('#'); result.Append(methodName); result.Append('>'); return(result); }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, TypeGroup /*!*/ self) { var result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<TypeGroup: "); bool isFirst = true; foreach (var entry in self.TypesByArity.ToSortedList((x, y) => x.Key - y.Key)) { Type type = entry.Value; if (!isFirst) { result.Append(", "); } else { isFirst = false; } result.Append(context.GetTypeName(type, true)); } result.Append('>'); return(result); }
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, char self) { return MutableString.Create( MutableString.AppendUnicodeRepresentation( new StringBuilder().Append('\''), self.ToString(), MutableString.Escape.Special, '\'', -1 ).Append("' (Char)").ToString(), context.GetIdentifierEncoding() ); }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, char self) { return(MutableString.Create( MutableString.AppendUnicodeRepresentation( new StringBuilder().Append('\''), self.ToString(), MutableString.Escape.Special, '\'', -1 ).Append("' (Char)").ToString(), context.GetIdentifierEncoding() )); }
public static MutableString/*!*/ TagUri(RubyContext/*!*/ context, object self) { var result = MutableString.Create(Tags.RubyObject, context.GetIdentifierEncoding()); var selfClass = context.GetClassOf(self); if (selfClass != context.ObjectClass) { return result.Append(':').Append(context.GetClassName(self)); } else { return result; } }
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, RubyEncoding/*!*/ self) { // TODO: to_s overridden MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(context.GetClassDisplayName(self)); result.Append(':'); result.Append(self.Name); result.Append('>'); return result; }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, RubyEncoding /*!*/ self) { // TODO: to_s overridden MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(context.GetClassDisplayName(self)); result.Append(':'); result.Append(self.Name); result.Append('>'); return(result); }
internal static MutableString /*!*/ GetTagUri(RubyContext /*!*/ context, object /*!*/ obj, string /*!*/ baseTag, Type /*!*/ baseType) { var result = MutableString.Create(baseTag, context.GetIdentifierEncoding()); if (obj.GetType() != baseType) { return(result.Append(':').Append(context.GetClassName(obj))); } else { return(result); } }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, BigDecimal /*!*/ self) { MutableString str = MutableString.CreateMutable(context.GetIdentifierEncoding()); str.AppendFormat("#<{0}:", context.GetClassOf(self).Name); RubyUtils.AppendFormatHexObjectId(str, RubyUtils.GetObjectId(context, self)); str.AppendFormat(",'{0}',{1}({2})>", self.ToString(10), self.PrecisionDigits, self.MaxPrecisionDigits ); return(str); }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, object self) { var result = MutableString.Create(Tags.RubyObject, context.GetIdentifierEncoding()); var selfClass = context.GetClassOf(self); if (selfClass != context.ObjectClass) { return(result.Append(':').Append(context.GetClassName(self))); } else { return(result); } }
public static MutableString /*!*/ TagUri(RubyContext /*!*/ context, object /*!*/ self) { var result = MutableString.Create(Tags.TimestampYmd, context.GetIdentifierEncoding()); string className = context.GetClassName(self); if (className != "Date") { return(result.Append(':').Append(className)); } else { return(result); } }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, Thread /*!*/ self) { RubyThreadInfo.RegisterThread(Thread.CurrentThread); MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(context.GetClassDisplayName(self)); result.Append(':'); RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(context, self)); result.Append(' '); RubyThreadStatus status = GetStatus(self); switch (status) { case RubyThreadStatus.Unstarted: result.Append("unstarted"); break; case RubyThreadStatus.Running: result.Append("run"); break; case RubyThreadStatus.Sleeping: result.Append("sleep"); break; case RubyThreadStatus.Aborting: result.Append("aborting"); break; case RubyThreadStatus.Completed: case RubyThreadStatus.Aborted: result.Append("dead"); break; } result.Append('>'); return(result); }
internal static MutableString/*!*/ GetTagUri(RubyContext/*!*/ context, object/*!*/ obj, string/*!*/ baseTag, Type/*!*/ baseType) { var result = MutableString.Create(baseTag, context.GetIdentifierEncoding()); if (obj.GetType() != baseType) { return result.Append(':').Append(context.GetClassName(obj)); } else { return result; } }
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, TypeGroup/*!*/ self) { var result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<TypeGroup: "); bool isFirst = true; foreach (var entry in self.TypesByArity.ToSortedList((x, y) => x.Key - y.Key)) { Type type = entry.Value; if (!isFirst) { result.Append(", "); } else { isFirst = false; } result.Append(context.GetTypeName(type, true)); } result.Append('>'); return result; }
public static MutableString/*!*/ GetName(RubyContext/*!*/ context, TypeGroup/*!*/ self) { return MutableString.Create(self.Name, context.GetIdentifierEncoding()); }
public static MutableString/*!*/ GetRubyName(RubyContext/*!*/ context, ClrName/*!*/ self) { return MutableString.Create(self.MangledName, context.GetIdentifierEncoding()); }
public static Exception/*!*/ ReinitializeException(RubyContext/*!*/ context, Exception/*!*/ self, [DefaultParameterValue(null)]object message) { var instance = RubyExceptionData.GetInstance(self); instance.Backtrace = null; instance.Message = message ?? MutableString.Create(context.GetClassOf(self).Name, context.GetIdentifierEncoding()); return self; }
private void WriteClass(RubyClass /*!*/ obj) { _writer.Write((byte)'c'); TestForAnonymous(obj); WriteStringValue(obj.Name, _context.GetIdentifierEncoding()); }
public static MutableString /*!*/ GetName(RubyContext /*!*/ context, TypeGroup /*!*/ self) { return(MutableString.Create(self.Name, context.GetIdentifierEncoding())); }
public static MutableString Inspect(RubyContext/*!*/ context, Thread/*!*/ self) { RubyThreadInfo.RegisterThread(Thread.CurrentThread); MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(context.GetClassDisplayName(self)); result.Append(':'); RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(context, self)); result.Append(' '); RubyThreadStatus status = GetStatus(self); switch (status) { case RubyThreadStatus.Unstarted: result.Append("unstarted"); break; case RubyThreadStatus.Running: result.Append("run"); break; case RubyThreadStatus.Sleeping: result.Append("sleep"); break; case RubyThreadStatus.Aborting: result.Append("aborting"); break; case RubyThreadStatus.Completed: case RubyThreadStatus.Aborted: result.Append("dead"); break; } result.Append('>'); return result; }
public static MutableString TagUri(RubyContext/*!*/ context, object/*!*/ self) { var result = MutableString.Create(Tags.TimestampYmd, context.GetIdentifierEncoding()); string className = context.GetClassName(self); if (className != "Date") { return result.Append(':').Append(className); } else { return result; } }
public static MutableString /*!*/ GetRubyName(RubyContext /*!*/ context, ClrName /*!*/ self) { return(MutableString.Create(self.MangledName, context.GetIdentifierEncoding())); }
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, BigDecimal/*!*/ self) { MutableString str = MutableString.CreateMutable(context.GetIdentifierEncoding()); str.AppendFormat("#<{0}:", context.GetClassOf(self).Name); RubyUtils.AppendFormatHexObjectId(str, RubyUtils.GetObjectId(context, self)); str.AppendFormat(",'{0}',{1}({2})>", self.ToString(10), self.PrecisionDigits, self.MaxPrecisionDigits ); return str; }
public static Exception /*!*/ ReinitializeException(RubyContext /*!*/ context, Exception /*!*/ self, [DefaultParameterValue(null)] object message) { var instance = RubyExceptionData.GetInstance(self); instance.Backtrace = null; instance.Message = message ?? MutableString.Create(context.GetClassOf(self).Name, context.GetIdentifierEncoding()); return(self); }
public MutableString GetDisplayName(RubyContext/*!*/ context, bool showEmptyName) { if (IsSingletonClass) { RubyClass c = (RubyClass)this; object singletonOf; MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); int nestings = 0; while (true) { nestings++; result.Append("#<Class:"); singletonOf = c.SingletonClassOf; RubyModule module = singletonOf as RubyModule; if (module == null || !module.IsSingletonClass && module.Name == null) { nestings++; result.Append("#<"); result.Append(c.SuperClass.GetName(context)); result.Append(':'); RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(_context, singletonOf)); break; } if (!module.IsSingletonClass) { result.Append(module.GetName(context)); break; } c = (RubyClass)module; } return result.Append('>', nestings); } else if (_name == null) { if (showEmptyName) { return null; } else { MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(_context.GetClassOf(this).GetName(context)); result.Append(':'); RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(_context, this)); result.Append('>'); return result; } } else { return MutableString.CreateMutable(GetName(context), context.GetIdentifierEncoding()); } }
/*!*/ internal static MutableString ToS(RubyContext/*!*/ context, string/*!*/ methodName, RubyModule/*!*/ declaringModule, RubyModule/*!*/ targetModule, string/*!*/ classDisplayName) { MutableString result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<"); result.Append(classDisplayName); result.Append(": "); if (ReferenceEquals(targetModule, declaringModule)) { result.Append(declaringModule.GetDisplayName(context, true)); } else { result.Append(targetModule.GetDisplayName(context, true)); result.Append('('); result.Append(declaringModule.GetDisplayName(context, true)); result.Append(')'); } result.Append('#'); result.Append(methodName); result.Append('>'); return result; }
public static MutableString GetClrName(RubyContext/*!*/ context, ClrName/*!*/ self) { return MutableString.Create(self.ActualName, context.GetIdentifierEncoding()); }