本文整理汇总了C#中Ruby.Class类的典型用法代码示例。如果您正苦于以下问题:C# Class类的具体用法?C# Class怎么用?C# Class使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Class类属于Ruby命名空间,在下文中一共展示了Class类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
// this functionality seems to be getting done in another method
// could not find a testing sequence that made this fail. Although
// Eval.getConst only calls it under certain circumstances.
return Init.rb_cObject.get_constants();
}
示例2: Calln
public override object Calln(Class last_class, object recv, Frame caller, ArgList args)
{
if (args.Length == 0)
return Call1(last_class, recv, caller, args.block, 1);
else
return Call1(last_class, recv, caller, args.block, args[0]);
}
示例3: Call1
public override object Call1(Class last_class, object recv, Frame caller, Proc block, object p1)
{
string path = String.StringValue(p1, caller);
Eval.rb_secure(2, caller);
return new FileStat(path);
}
示例4: Basic
internal bool finalize_flag = false; // for deprecated ObjectSpace finalizers
// -----------------------------------------------------------------------------
public Basic(Class klass)
{
this.my_class = klass;
this.frozen = false;
this.tainted = false;
ObjectSpace.objects.Add(new System.WeakReference(this));
}
示例5: Call1
public override object Call1(Class last_class, object recv, Frame caller, Proc block, object param0)
{
if (param0 is bool)
return (bool)param0;
return param0 != null;
}
示例6: Call
public override object Call(Class last_class, object recv, Frame caller, Proc block, Array rest)
{
object time, t;
long seconds = 0;
long uSeconds = 0;
if (Class.rb_scan_args(caller, rest, 1, 1, false) == 2)
{
time = rest[0];
t = rest[1];
seconds = Numeric.rb_num2long(rest[0], caller);
uSeconds = Numeric.rb_num2long(rest[1], caller);
}
else
{
time = rest[0];
Time.rb_time_timeval(rest[0], out seconds, out uSeconds, caller);
}
if (time is Time)
{
bool gmt = ((Time)time).gmt;
t = Time.time_new_internal(seconds, uSeconds, gmt, caller);
}
else
{
t = Time.time_new_internal(seconds, uSeconds, false, caller);
((Time)t).value = ((Time)t).value.ToLocalTime();
}
return t;
}
示例7: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
bool old = GC.dont_gc;
GC.dont_gc = true;
return old;
}
示例8: Call1
public override object Call1(Class last_class, object recv, Frame caller, Proc block, object p1)
{
if (recv == p1)
return true;
else
return Object.Equals(((ProcessStatus)recv).st, p1);
}
示例9: Call1
public override object Call1(Class last_class, object recv, Frame caller, Proc block, object p1)
{
if (Numeric.random == null)
rb_f_srand.singleton.Call0(last_class, recv, caller, null);
int max;
if (p1 == null)
max = 0;
else if (p1 is int)
max = (int)p1;
else if (p1 is Bignum)
return rb_big_rand((Bignum)p1, Numeric.random.NextDouble());
else if (p1 is Float)
{
if (((Float)p1).value <= int.MaxValue && ((Float)p1).value >= int.MinValue)
max = (int)((Float)p1).value;
else
return rb_big_rand(new Bignum(((Float)p1).value), Numeric.random.NextDouble());
}
else
{
p1 = Integer.rb_Integer(p1, caller);
if (p1 is Bignum)
return rb_big_rand((Bignum)p1, Numeric.random.NextDouble());
max = (int)System.Math.Abs(Numeric.rb_num2long(p1, caller));
}
if (max == 0)
return new Float(Numeric.random.NextDouble());
else if (max < 0)
max = -max;
return (int)(max * Numeric.random.NextDouble());
}
示例10: Method
internal Method(object recv, string id, string oid, Class rklass, RubyMethod body)
: this(recv, id)
{
this.oid = oid;
this.rklass = rklass;
this.body = body;
}
示例11: Call1
public override object Call1(Class last_class, object recv, Frame caller, Proc block, object p1)
{
Object.CheckType<Class>(caller, p1);
Class.rb_define_singleton_method(p1, "induced_from", prec_induced_from.singleton, 1, caller);
return recv;
}
示例12: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
if (Numeric.random == null)
rb_f_srand.singleton.Call0(last_class, recv, caller, null);
return new Float(Numeric.random.NextDouble());
}
示例13: Call1
public override object Call1(Class last_class, object from, Frame caller, Proc block, object to)
{
if (from is int && to is int)
{
int end = (int)to;
if (block == null)
throw new LocalJumpError("no block given").raise(caller);
for (int i = (int)from; i <= end; i++)
Proc.rb_yield(block, caller, i);
}
else
{
object i = from;
while (!(bool)Eval.CallPrivate(i, caller, ">", null, to))
{
if (block == null)
throw new LocalJumpError("no block given").raise(caller);
Proc.rb_yield(block, caller, i);
i = Eval.CallPrivate(i, caller, "+", null, 1);
}
}
return from;
}
示例14: Call0
public override object Call0(Class last_class, object recv, Frame caller, Proc block)
{
Match md = (Match)recv;
String str = new String(md.matched.Substring(0, md.value.Index));
if (md.Tainted) str.Tainted = true;
return str;
}
示例15: Call
public override object Call(Class last_class, object str, Frame caller, Proc block, Array argv)
{
int argc = argv.Count;
object result;
if (argc < 1 || 2 < argc)
{
throw new ArgumentError(string.Format(CultureInfo.InvariantCulture, "wrong number of arguments ({0} for 1)", argc)).raise(caller);
}
Array buf = new Array();
int i;
for (i = 0; i < argc; i++)
{
buf.Add(argv[i]);
}
result = rb_str_aref_m.singleton.Call(last_class, str, caller, null, buf);
if (result != null)
{
buf.Add(new String());
rb_str_aset_m.singleton.Call(last_class, str, caller, null, buf);
}
return result;
}