本文整理汇总了C#中NETRuby.RBasic类的典型用法代码示例。如果您正苦于以下问题:C# RBasic类的具体用法?C# RBasic怎么用?C# RBasic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RBasic类属于NETRuby命名空间,在下文中一共展示了RBasic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ruby_float
public object ruby_float(RBasic r, params object[] o)
{
if (o[0] == null || o[0] == ruby.oNil) return new RFloat(ruby, 0.0);
RBasic x = ruby.InstanceOf(o[0]);
return (RFloat)ruby.ConvertType(x, typeof(RFloat), "Float", "to_f");
}
示例2: RBasic
internal RBasic(RBasic o)
{
ruby = o.ruby;
if (o.klass is RSingletonClass)
{
RMetaObject org = o.klass;
RMetaObject meta = (RMetaObject)org.Clone();
if (meta.m_tbl == null) meta.m_tbl = new st_table();
else meta.m_tbl.Clear();
/*
foreach (DictionaryEntry ent in org.m_tbl)
{
RNMethod m = (RNMethod)ent.Value;
meta.m_tbl.Add(ent.Key, new RNMethod(m));
}
*/
klass = meta;
}
else
{
klass = o.klass;
}
flags = o.flags;
/*
if (o.Test(FL.EXIVAR))
{
ruby.CloneGenericIVar(this, o);
}
*/
GetHashCode(); // define ID
}
示例3: ruby_p
public object ruby_p(RBasic r, params object[] o)
{
foreach (object x in o)
{
System.Console.Out.Write(RString.AsString(ruby, ruby.Inspect(x)) + ruby.defaultRecSep);
}
// check defout and if file, then flush
return null;
}
示例4: find_all
private static object find_all(RBasic r, params object[] args)
{
/*
NetRuby ruby = r.ruby;
RArray ary = new RArray(ruby, true);
ruby.Iterate(new NetRuby.IterationProc(Each), r,
new NetRuby.BlockProc(find_all_i), ary);
return ary;
*/
return null; //PH
}
示例5: collect
private static object collect(RBasic r, params object[] args)
{
/*
NetRuby ruby = r.ruby;
RArray ary = new RArray(ruby, true);
ruby.Iterate(new NetRuby.IterationProc(Each), r,
(ruby.IsBlockGiven) ? new NetRuby.BlockProc(collect_i) :
new NetRuby.BlockProc(enum_all), ary);
return ary;
*/
return null; //PH
}
示例6: ruby_array
public object ruby_array(RBasic r, params object[] o)
{
RBasic x = ruby.InstanceOf(o[0]);
object val;
uint to_ary = ruby.intern("to_ary");
if (x.RespondTo(to_ary, false))
val = ruby.Funcall(x, to_ary, null);
else
val = ruby.Funcall(x, ruby.intern("to_a"), null);
if (val is RArray == false)
throw new eTypeError("`to_a' did not return Array");
return (RArray)val;
}
示例7: IsKindOf
public object IsKindOf(RBasic obj, params object[] o)
{
RMetaObject cl = ruby.ClassOf(obj);
object c = o[0];
if (c is RMetaObject == false)
{
throw new eTypeError("class or module required");
}
while (cl != null)
{
if (cl == c || cl.m_tbl == ((RMetaObject)c).m_tbl)
return true;
cl = cl.super;
}
return false;
}
示例8: IsInstanceOf
public object IsInstanceOf(RBasic r, params object[] args)
{
object o = args[0];
if (o == null)
{
return (r == ruby.oNil) ? true : false;
}
else if (o is bool)
{
return ((bool)o) ? r == ruby.oTrue : r == ruby.oFalse;
}
else if (o is RMetaObject == false)
{
throw new eTypeError("class or module required");
}
return r.Class == o;
}
示例9: ruby_print
public object ruby_print(RBasic r, params object[] o)
{
string s = String.Empty;
if (o.Length == 0)
{
s = obj_to_s(NetRuby.lastLineGetter(0, null, ruby));
}
else
{
foreach (object x in o)
{
s += obj_to_s(x);
}
}
System.Console.Out.Write(s);
return null;
}
示例10: Call
// A block argument to blocks is allowed in newer versions of Ruby
public abstract RBasic Call(RThread thread, RBasic[] args, RCBlock block);
示例11: inspect_join
private object inspect_join(RBasic ary, object[] args)
{
RString rs = ((RArray)args[0]).Join(args[1]);
return rs;
}
示例12: AssocNew
static public RArray AssocNew(NetRuby ruby, RBasic car, RBasic cdr)
{
ArrayList ar = new ArrayList();
ar.Add(car);
ar.Add(cdr);
return new RArray(ruby, ar);
}
示例13: add
static internal object add(RBasic r, params object[] args)
{
return ((RThreadGroup)r).Add(args[0]);
}
示例14: tg_new
static internal object tg_new(RBasic r, params object[] args)
{
return NewThreadGroup(args, (RMetaObject)r);
}
示例15: thread_aset
static internal object thread_aset(RBasic r, params object[] args)
{
return ((RThread)r).SetTLS(args[0], args[1]);
}