本文整理汇总了C#中RubyContext.GetIdentifierEncoding方法的典型用法代码示例。如果您正苦于以下问题:C# RubyContext.GetIdentifierEncoding方法的具体用法?C# RubyContext.GetIdentifierEncoding怎么用?C# RubyContext.GetIdentifierEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RubyContext
的用法示例。
在下文中一共展示了RubyContext.GetIdentifierEncoding方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Inspect
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()
);
}
示例2: TagUri
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;
}
}
示例3: Inspect
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;
}
示例4: GetTagUri
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;
}
}
示例5: Inspect
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;
}
示例6: GetName
public static MutableString/*!*/ GetName(RubyContext/*!*/ context, TypeGroup/*!*/ self) {
return MutableString.Create(self.Name, context.GetIdentifierEncoding());
}
示例7: ToS
/*!*/
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;
}
示例8: GetDisplayName
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());
}
}
示例9: Inspect
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;
}
示例10: GetRubyName
public static MutableString/*!*/ GetRubyName(RubyContext/*!*/ context, ClrName/*!*/ self) {
return MutableString.Create(self.MangledName, context.GetIdentifierEncoding());
}
示例11: Inspect
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;
}
示例12: TagUri
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;
}
}
示例13: ReinitializeException
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;
}
示例14: GetClrName
public static MutableString GetClrName(RubyContext/*!*/ context, ClrName/*!*/ self)
{
return MutableString.Create(self.ActualName, context.GetIdentifierEncoding());
}