本文整理汇总了C#中NETRuby.NetRuby.ClassOf方法的典型用法代码示例。如果您正苦于以下问题:C# NetRuby.ClassOf方法的具体用法?C# NetRuby.ClassOf怎么用?C# NetRuby.ClassOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NETRuby.NetRuby
的用法示例。
在下文中一共展示了NetRuby.ClassOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
//.........这里部分代码省略.........
RMethod rm = new RMethod(ruby_id);
DefineMethod("hash", rm, 0);
DefineMethod("id", rm, 0);
DefineMethod("__id__", rm, 0);
rm = new RMethod(ruby_class);
DefineMethod("type", rm, 0);
DefineMethod("class", rm, 0);
DefineMethod("clone", new RMethod(ruby_clone), 0);
DefineMethod("dup", new RMethod(ruby_dup), 0);
DefineMethod("taint", new RMethod(ruby_taint), 0);
DefineMethod("tainted?", new RMethod(ruby_istainted), 0);
DefineMethod("Untaint", new RMethod(ruby_untaint), 0);
DefineMethod("freeze", new RMethod(ruby_freeze), 0);
DefineMethod("frozen?", new RMethod(ruby_isfrozen), 0);
DefineMethod("to_a", new RMethod(ruby_to_a), 0);
DefineMethod("to_s", new RMethod(ruby_to_s), 0);
DefineMethod("inspect", new RMethod(ruby_inspect), 0);
rm = new RMethod(ruby_methods);
DefineMethod("methods", rm, 0);
DefineMethod("public_methods", rm, 0);
DefineMethod("singleton_methods", new RMethod(ruby_singleton_methods), 0);
DefineMethod("protected_methods", new RMethod(ruby_protected_methods), 0);
DefineMethod("private_methods", new RMethod(ruby_private_methods), 0);
DefineMethod("instance_variables", new RMethod(ruby_instance_variables), 0);
DefinePrivateMethod("remove_instance_variable",
new RMethod(ruby_remove_instance_variable), 1);
DefineMethod("instance_of?", new RMethod(IsInstanceOf), 1);
rm = new RMethod(IsKindOf);
DefineMethod("kind_of?", rm, 1);
DefineMethod("is_a?", rm, 1);
rb.DefineGlobalFunction("singleton_method_added", rmDummy, 1);
rb.DefineGlobalFunction("sprintf", new RMethod(sprintf), -1);
rb.DefineGlobalFunction("format", new RMethod(sprintf), -1);
rb.DefineGlobalFunction("Integer", new RMethod(ruby_integer), 1);
rb.DefineGlobalFunction("Float", new RMethod(ruby_float), 1);
rb.DefineGlobalFunction("String", new RMethod(ruby_string), 1);
rb.DefineGlobalFunction("Array", new RMethod(ruby_array), 1);
rb.DefineGlobalFunction("sleep", new RMethod(ruby_sleep), -1);
rb.oNil = new RNil(rb);
rb.oNil.Init(rb);
Symbol.Init(rb);
obj = typeof(RMetaObject);
rb.cModule.DefineMethod("===", obj.GetMethod("Eqq"));
rb.cModule.DefineMethod("<=>", obj.GetMethod("CompareTo"));
rb.cModule.DefineMethod("<", obj.GetMethod("lt"));
rb.cModule.DefineMethod("<=", obj.GetMethod("le"));
rb.cModule.DefineMethod(">", obj.GetMethod("gt"));
rb.cModule.DefineMethod(">=", obj.GetMethod("ge"));
rb.cModule.DefineMethod("included_modules", obj.GetMethod("IncludedModules"));
rb.cModule.DefineMethod("name", obj.GetMethod("get_ModuleName"));
rb.cModule.DefineMethod("attr", new RMethod(attr), -1);
rb.cModule.DefineMethod("attr_reader", new RMethod(attr_reader), -1);
rb.cModule.DefineMethod("attr_writer", new RMethod(attr_writer), -1);
rb.cModule.DefineMethod("attr_accessor", new RMethod(attr_accessor), -1);
rb.cModule.DefineSingletonMethod("new", new RMethod(s_new), 0);
rb.cModule.DefineMethod("initialize", new RMethod(initialize), -1);
rb.cModule.DefineMethod("instance_methods", obj.GetMethod("ClassInstanceMethods", bf));
rb.cModule.DefineMethod("public_instance_methods", obj.GetMethod("ClassInstanceMethods", bf));
rb.cModule.DefineMethod("protected_instance_methods", obj.GetMethod("ClassProtectedInstanceMethods", bf));
rb.cModule.DefineMethod("private_instance_methods", obj.GetMethod("ClassPrivateInstanceMethods", bf));
rb.cModule.DefineMethod("constants", new RMethod(rb.cModule.constants), 0);
rb.cModule.DefineMethod("const_get", new RMethod(rb.cModule.const_get), 1);
rb.cModule.DefineMethod("const_set", new RMethod(rb.cModule.const_set), 2);
rb.cModule.DefineMethod("const_defined?", new RMethod(rb.cModule.is_const_defined), 1);
rb.cModule.DefineMethod("remove_const", new RMethod(rb.cModule.remove_const), 1);
rb.cModule.DefineMethod("method_added", rmDummy, 1);
obj = rb.cClass.GetType();
rb.cClass.DefineMethod("new", new RMethod(ruby_new), -1);
rb.cClass.DefineMethod("superclass", new RMethod(ruby_superclass), 0);
rb.cClass.DefineSingletonMethod("new", new RMethod(ruby_s_new), -1);
rb.cClass.UndefMethod("extend_object");
rb.cClass.UndefMethod("append_feartures");
rb.cClass.DefineSingletonMethod("inherited", new RMethod(RClass.Inherited), 1);
rb.cData = rb.DefineClass("Data", rb.cObject);
rb.ClassOf(rb.cData).UndefMethod("new");
rb.topSelf = new RMainObject(rb);
rb.oTrue = new RTrue(rb);
rb.oTrue.Init(rb);
rb.oFalse = new RFalse(rb);
rb.oFalse.Init(rb);
}
示例2: check
static private RThread check(NetRuby rb, object o)
{
if (o is RThread == false)
throw new eTypeError(String.Format("wrong argument type {0} (expected Thread)",
rb.ClassOf(o).Name));
return (RThread)o;
}
示例3: Init
internal void Init(NetRuby rb)
{
rb.cFalseClass = rb.DefineClass("FalseClass", rb.cObject);
rb.cFalseClass.DefineMethod("&", new RMethod(ruby_and), 1);
rb.cFalseClass.DefineMethod("|", new RMethod(ruby_or), 1);
rb.cFalseClass.DefineMethod("^", new RMethod(ruby_xor), 1);
rb.ClassOf(rb.cFalseClass).UndefMethod("new");
rb.DefineGlobalConst("FALSE", false);
}
示例4: Init
static internal void Init(NetRuby rb)
{
rb.eRegexpError = rb.DefineClass("RegexpError", rb.eStandardError);
rb.DefineVirtualVariable("$~",
new GlobalEntry.Getter(matchGetter),
new GlobalEntry.Setter(matchSetter));
rb.DefineVirtualVariable("$&",
new GlobalEntry.Getter(lastMatchGetter), null);
rb.DefineVirtualVariable("$`",
new GlobalEntry.Getter(preMatchGetter), null);
rb.DefineVirtualVariable("$'",
new GlobalEntry.Getter(postMatchGetter), null);
rb.DefineVirtualVariable("$+",
new GlobalEntry.Getter(lastParenGetter), null);
rb.DefineVirtualVariable("$=",
new GlobalEntry.Getter(iCaseGetter),
new GlobalEntry.Setter(iCaseSetter));
rb.DefineVirtualVariable("$KCODE",
new GlobalEntry.Getter(kCodeGetter),
new GlobalEntry.Setter(kCodeSetter));
rb.DefineVirtualVariable("$-K",
new GlobalEntry.Getter(kCodeGetter),
new GlobalEntry.Setter(kCodeSetter));
RRegexpClass reg = new RRegexpClass(rb);
reg.DefineClass("Regexp", rb.cObject);
rb.cRegexp = reg;
reg.DefineSingletonMethod("new", new RMethod(s_new), -1);
reg.DefineSingletonMethod("compile", new RMethod(s_new), -1);
reg.DefineSingletonMethod("quote", new RMethod(s_quote), -1);
reg.DefineSingletonMethod("escape", new RMethod(s_quote), -1);
reg.DefineSingletonMethod("last_match", new RMethod(s_lastmatch), 0);
reg.DefineMethod("initialize", new RMethod(initialize), -1);
reg.DefineMethod("=~", new RMethod(match), 1);
reg.DefineMethod("===", new RMethod(match), 1);
reg.DefineMethod("~", new RMethod(match2), 0);
reg.DefineMethod("match", new RMethod(match_m), 1);
reg.DefineMethod("source", new RMethod(source), 0);
reg.DefineMethod("casefold?", new RMethod(casefold_p), 0);
reg.DefineMethod("kcode", new RMethod(kcode_m), 0);
reg.DefineConst("IGNORECASE", RegexOptions.IgnoreCase);
reg.DefineConst("EXTENDED", RegexOptions.IgnorePatternWhitespace);
reg.DefineConst("MULTILINE", RegexOptions.Multiline);
RClass md = rb.DefineClass("MatchData", rb.cObject);
rb.DefineGlobalConst("MatchingData", md);
rb.cMatch = md;
rb.ClassOf(md).UndefMethod("new");
md.DefineMethod("size", new RMethod(match_size), 0);
md.DefineMethod("length", new RMethod(match_size), 0);
md.DefineMethod("offset", new RMethod(match_offset), 1);
md.DefineMethod("begin", new RMethod(match_begin), 1);
md.DefineMethod("end", new RMethod(match_end), 1);
md.DefineMethod("to_a", new RMethod(match_to_a), 0);
md.DefineMethod("[]", new RMethod(match_aref), -1);
md.DefineMethod("pre_match", new RMethod(match_pre), 0);
md.DefineMethod("post_match", new RMethod(match_post), 0);
md.DefineMethod("to_s", new RMethod(match_to_s), 0);
md.DefineMethod("string", new RMethod(match_string), 0);
}
示例5: Init
internal static new void Init(NetRuby rb)
{
RClass it = rb.DefineClass("Integer", rb.cNumeric);
rb.cInteger = it;
rb.ClassOf(it).UndefMethod("new");
it.DefineMethod("upto", new RMethod(int_upto), 1);
it.DefineMethod("downto", new RMethod(int_downto), 1);
it.DefineMethod("step", new RMethod(int_step), 2);
it.DefineMethod("to_int", new RMethod(num_to_i), 0);
it.DefineMethod("floor", new RMethod(num_to_i), 0);
it.DefineMethod("ceil", new RMethod(num_to_i), 0);
it.DefineMethod("round", new RMethod(num_to_i), 0);
}