本文整理汇总了C#中NETRuby.NetRuby.Funcall方法的典型用法代码示例。如果您正苦于以下问题:C# NetRuby.Funcall方法的具体用法?C# NetRuby.Funcall怎么用?C# NetRuby.Funcall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NETRuby.NetRuby
的用法示例。
在下文中一共展示了NetRuby.Funcall方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsString
public static string AsString(NetRuby ruby, object x)
{
if (x == null)
return String.Empty;
if (x is string)
return (string)x;
if (x is RString)
return x.ToString();
object o = ruby.Funcall(x, "to_s", null);
return o.ToString();
}
示例2: ClassNew
static public RClass ClassNew(NetRuby ruby, RMetaObject spr, object[] o)
{
if (spr == null)
{
spr = ruby.cObject;
}
else if (spr is RSingletonClass)
{
throw new eTypeError("can't make subclass of virtual class");
}
RClass klass = new RClass(ruby, spr);
klass.klass = new RSingletonClass(spr.klass);
klass.klass.AttachSingleton(klass);
ruby.CallInit(klass, o);
ruby.Funcall(spr, "inherited", new object[1] { klass });
return klass;
}
示例3: AsRString
// create new instance(INFECTED) RString
public static RString AsRString(NetRuby ruby, object x)
{
if (x == null)
return new RString(ruby, String.Empty);
if (x is string)
return new RString(ruby, (string)x, false);
if (x is RString)
return (RString)x;
object o = ruby.Funcall(x, "to_s", null);
if (o is string)
return new RString(ruby, (string)o);
if (o is RString)
{
RString r = (RString)o;
if (x is RBasic && ((RBasic)x).IsTainted)
r.Set(FL.TAINT);
return r;
}
else if (o is RBasic)
return ((RBasic)o).ToRString();
else
return new RString(ruby, o.ToString());
}