static internal void Init(NetRuby ruby) { RClass num = ruby.DefineClass("Numeric", ruby.cObject); ruby.cNumeric = num; num.DefineMethod("coerce", new RMethod(num_coerce), 1); num.DefineMethod("to_i", new RMethod(num_to_i), 0); num.DefineMethod("truncate", new RMethod(num_to_i), 0); num.DefineMethod("+@", new RMethod(num_uplus), 0); num.DefineMethod("-@", new RMethod(num_uminus), 0); num.DefineMethod("===", new RMethod(num_equal), 1); num.DefineMethod("+", new RMethod(num_plus), 1); num.DefineMethod("-", new RMethod(num_minus), 1); num.DefineMethod("*", new RMethod(num_mul), 1); num.DefineMethod("/", new RMethod(num_div), 1); num.DefineMethod("%", new RMethod(num_mod), 1); num.DefineMethod("modulo", new RMethod(num_mod), 1); num.DefineMethod("divmod", new RMethod(num_divmod), 1); num.DefineMethod("remainder", new RMethod(num_remainder), 1); num.DefineMethod("<=>", new RMethod(num_cmp), 1); num.DefineMethod(">", new RMethod(num_gt), 1); num.DefineMethod(">=", new RMethod(num_ge), 1); num.DefineMethod("<", new RMethod(num_lt), 1); num.DefineMethod("<=", new RMethod(num_le), 1); }
static internal void Init(NetRuby rb) { BindingFlags bf = BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance; RClass ary = rb.DefineClass("Array", rb.cObject); RMetaObject.IncludeModule(ary, rb.mEnumerable); rb.cArray = ary; Type obj = typeof(RArray); ary.DefineSingletonMethod("new", new RMethod(s_new), -1); ary.DefineSingletonMethod("[]", obj.GetMethod("Create", bf)); ary.DefineMethod("initialize", obj.GetMethod("Initialize", bf)); ary.DefineMethod("to_ary", obj.GetMethod("ToArray", bf)); ary.DefineMethod("==", obj.GetMethod("ArrayEqual", bf)); ary.DefineMethod("eql?", obj.GetMethod("ArrayEql", bf)); ary.DefineMethod("[]", obj.GetMethod("ARef", bf)); ary.DefineMethod("[]=", obj.GetMethod("ASet", bf)); ary.DefineMethod("at", obj.GetMethod("At", bf)); ary.DefineMethod("first", obj.GetMethod("get_First", bf)); ary.DefineMethod("last", obj.GetMethod("get_Last", bf)); ary.DefineMethod("concat", obj.GetMethod("Concat", bf)); ary.DefineMethod("<<", obj.GetMethod("Push", bf)); ary.DefineMethod("push", obj.GetMethod("Push", bf)); ary.DefineMethod("pop", obj.GetMethod("Pop", bf)); ary.DefineMethod("shift", obj.GetMethod("Shift", bf)); ary.DefineMethod("unshift", obj.GetMethod("Unshift", bf)); ary.DefineMethod("each", obj.GetMethod("Each", bf)); ary.DefineMethod("each_index", obj.GetMethod("EachIndex", bf)); ary.DefineMethod("reverse_each", obj.GetMethod("ReverseEach", bf)); ary.DefineMethod("length", obj.GetMethod("get_Count", bf)); ary.DefineAlias("size", "length"); ary.DefineMethod("empty?", obj.GetMethod("get_IsEmpty", bf)); ary.DefineMethod("index", obj.GetMethod("Index", bf)); ary.DefineMethod("rindex", obj.GetMethod("RIndex", bf)); ary.DefineMethod("clone", obj.GetMethod("Clone", bf)); ary.DefineMethod("join", obj.GetMethod("JoinMethod", bf)); ary.DefineMethod("reverse", obj.GetMethod("Reverse", bf)); ary.DefineMethod("reverse!", obj.GetMethod("ReverseAt", bf)); ary.DefineMethod("sort", obj.GetMethod("Sort", bf)); ary.DefineMethod("sort!", obj.GetMethod("SortAt", bf)); ary.DefineMethod("collect", obj.GetMethod("Collect", bf)); ary.DefineMethod("collect!", obj.GetMethod("CollectAt", bf)); ary.DefineMethod("delete", obj.GetMethod("Delete", bf)); ary.DefineMethod("delete_at", obj.GetMethod("DeleteAt", bf)); ary.DefineMethod("clear", obj.GetMethod("Clear2", bf)); ary.DefineMethod("fill", obj.GetMethod("Fill", bf)); ary.DefineMethod("include", obj.GetMethod("Contains", bf)); }
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); }
static internal void Init(NetRuby rb) { RClass sym = rb.DefineClass("Symbol", rb.cObject); rb.cSymbol = sym; rb.oSymbol = new Symbol(rb); sym.DefineMethod("to_i", new RMethod(to_i), 0); sym.DefineMethod("to_int", new RMethod(to_i), 0); sym.DefineMethod("inspect", new RMethod(inspect), 0); sym.DefineMethod("to_s", new RMethod(to_s), 0); sym.DefineMethod("id2name", new RMethod(to_s), 0); }
static internal void Init(NetRuby rb) { BindingFlags bf = BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance; RClass str = rb.DefineClass("String", rb.cObject); rb.cString = str; rb.oString = new RString(rb, String.Empty); #if MIXIN RClass.IncludeModule(str, rb.mComparable); RClass.IncludeModule(str, rb.mEnumerable); #endif Type obj = typeof(RString); str.DefineSingletonMethod("new", obj.GetMethod("New", bf)); str.DefineMethod("initialize", obj.GetMethod("Initialize", bf)); str.DefineMethod("clone", obj.GetMethod("Clone", bf)); str.DefineMethod("dup", obj.GetMethod("Dup", new Type[0])); str.DefineMethod("<=>", obj.GetMethod("CompareMethod", bf)); str.DefineMethod("eql?", obj.GetMethod("Equals", bf & (~BindingFlags.Static))); str.DefineMethod("equal?", new RMethod(rb.oString.str_equal), 1); str.DefineMethod("+", obj.GetMethod("Plus", bf)); str.DefineMethod("length", obj.GetMethod("get_Length", bf)); str.DefineMethod("size", obj.GetMethod("get_Length", bf)); str.DefineMethod("empty?", obj.GetMethod("get_IsEmpty", bf)); str.DefineMethod("to_i", obj.GetMethod("ToInteger", new Type[0])); str.DefineMethod("to_f", obj.GetMethod("ToFloat", bf)); MethodInfo mi = obj.GetMethod("ToRString", bf); str.DefineMethod("to_s", mi); str.DefineMethod("to_str", mi); str.DefineMethod("inspect", obj.GetMethod("Inspect", bf)); str.DefineMethod("dump", obj.GetMethod("Dump", bf)); str.DefineMethod("upcase", obj.GetMethod("UpCase", bf)); str.DefineMethod("downcase", obj.GetMethod("DownCase", bf)); str.DefineMethod("capitalize", obj.GetMethod("Capitalize", bf)); str.DefineMethod("swapcase", obj.GetMethod("SwapCase", bf)); str.DefineMethod("upcase!", obj.GetMethod("UpCaseBang", bf)); str.DefineMethod("downcase!", obj.GetMethod("DownCaseBang", bf)); str.DefineMethod("capitalize!", obj.GetMethod("CapitalizeBang", bf)); str.DefineMethod("swapcase!", obj.GetMethod("SwapCaseBang", bf)); str.DefineMethod("sub", obj.GetMethod("Sub", bf)); str.DefineMethod("gsub", obj.GetMethod("Gsub", bf)); str.DefineMethod("sub!", obj.GetMethod("SubAt", bf)); str.DefineMethod("gsub!", obj.GetMethod("GsubAt", bf)); }
static internal new void Init(NetRuby rb) { RClass big = rb.DefineClass("Bignum", rb.cInteger); rb.cBignum = big; big.DefineMethod("~", new RMethod(ruby_neg), 0); RMethod rm = new RMethod(ruby_eq); big.DefineMethod("==", rm, 1); big.DefineMethod("===", rm, 1); big.DefineMethod("eql?", rm, 1); }
static internal new void Init(NetRuby rb) { RClass fix = rb.DefineClass("Fixnum", rb.cInteger); rb.cFixnum = fix; RFixnum o = new RFixnum(rb); rb.oFixnum = o; rb.oFixZero = new RFixnum(rb, 0); fix.DefineMethod("to_f", new RMethod(o.ruby_to_f), 0); fix.DefineMethod("to_c", new RMethod(o.ruby_to_c), 0); fix.DefineMethod("==", new RMethod(fix_equal), 1); }
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); }
internal static void Init(NetRuby rb) { rb.eThreadError = rb.DefineClass("ThreadError", rb.eException); RThreadClass t = new RThreadClass(rb); t.DefineClass("Thread", rb.cObject); rb.cThread = t; t.DefineSingletonMethod("new", new RMethod(thread_new), -1); t.DefineMethod("initialize", new RMethod(initialize), -2); t.DefineSingletonMethod("start", new RMethod(thread_start), -2); t.DefineSingletonMethod("fork", new RMethod(thread_start), -2); t.DefineSingletonMethod("stop", new RMethod(thread_stop), 0); t.DefineSingletonMethod("kill", new RMethod(thread_s_kill), 1); t.DefineSingletonMethod("exit", new RMethod(thread_exit), 0); t.DefineSingletonMethod("pass", new RMethod(thread_pass), 0); t.DefineSingletonMethod("current", new RMethod(thread_current), 0); t.DefineSingletonMethod("main", new RMethod(thread_main), 0); t.DefineSingletonMethod("list", new RMethod(thread_list), 0); t.DefineSingletonMethod("critical", new RMethod(critical_getset), 0); t.DefineSingletonMethod("critical", new RMethod(critical_getset), 1); t.DefineSingletonMethod("abort_on_exception", new RMethod(thread_s_abort_exc), 0); t.DefineSingletonMethod("abort_on_exception=", new RMethod(thread_s_abort_set), 1); t.DefineMethod("run", new RMethod(thread_run), 0); t.DefineMethod("wakeup", new RMethod(thread_wakeup), 0); t.DefineMethod("kill", new RMethod(thread_kill), 0); t.DefineMethod("exit", new RMethod(thread_kill), 0); t.DefineMethod("value", new RMethod(thread_value), 0); t.DefineMethod("status", new RMethod(thread_status), 0); t.DefineMethod("join", new RMethod(thread_join), 0); t.DefineMethod("alive?", new RMethod(thread_alive), 0); t.DefineMethod("stop?", new RMethod(thread_isstop), 0); t.DefineMethod("raise", new RMethod(thread_raise), 0); t.DefineMethod("abort_on_exception", new RMethod(thread_abort_exc), 0); t.DefineMethod("abort_on_exception=", new RMethod(thread_abort_set), 1); t.DefineMethod("priority", new RMethod(thread_priority), 0); t.DefineMethod("priority=", new RMethod(thread_priority_set), 1); ////t.DefineMethod("safe_level", new RMethod(thread_safe_level), 0); t.DefineMethod("[]", new RMethod(thread_aref), 1); t.DefineMethod("[]=", new RMethod(thread_aset), 2); t.DefineMethod("key?", new RMethod(thread_keyp), 1); }
internal void Init(NetRuby rb) { BindingFlags bf = BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance; rb.cNilClass = rb.DefineClass("NilClass", rb.cObject); Type obj = typeof(RNil); rb.cNilClass.DefineMethod("to_i", obj.GetMethod("ToInteger", bf)); rb.cNilClass.DefineMethod("to_a", obj.GetMethod("ToArray", bf)); rb.cNilClass.DefineMethod("to_s", new RMethod(nil_to_s), 0); rb.cNilClass.DefineMethod("&", new RMethod(ruby_and), 1); rb.cNilClass.DefineMethod("|", new RMethod(ruby_or), 1); rb.cNilClass.DefineMethod("^", new RMethod(ruby_xor), 1); rb.cNilClass.DefineMethod("nil?", new RMethod(ruby_true), 0); rb.ClassOf(rb.cNilClass).UndefMethod("new"); rb.DefineGlobalConst("NIL", null); }
static internal new void Init(NetRuby rb) { BindingFlags bf = BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance; RClass flo = rb.DefineClass("Float", rb.cNumeric); rb.cFloat = flo; rb.oFloat = new RFloat(rb, 0.0); Type obj = typeof(RFloat); rb.ClassOf(flo).UndefMethod("new"); flo.DefineMethod("floor", obj.GetMethod("get_Floor", bf)); flo.DefineMethod("ceil", obj.GetMethod("get_Ceil", bf)); flo.DefineMethod("round", obj.GetMethod("get_Round", bf)); flo.DefineMethod("nan?", obj.GetMethod("get_IsNaN", bf)); flo.DefineMethod("infinite?", obj.GetMethod("get_IsInfinite", bf)); flo.DefineMethod("finite?", obj.GetMethod("get_IsFinite", bf)); }
internal void Init(NetRuby rb) { BindingFlags bf = BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Instance; RMethod rmDummy = new RMethod(ruby_dummy); rb.cObject.DefinePrivateMethod("initialize", rmDummy, 0); rb.cClass.DefinePrivateMethod("inherited", rmDummy, 1); DefineMethod("nil?", new RMethod(ruby_isnil), 0); DefineMethod("==", new RMethod(ruby_equals), 1); DefineAlias("equal?", "=="); DefineAlias("===", "=="); DefineMethod("=~", new RMethod(ruby_false), 1); DefineMethod("eql?", new RMethod(ruby_eql), 1); Type obj = GetType(); 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); }
internal static void Init(NetRuby rb) { RClass ex = rb.DefineClass("Exception", rb.cObject); rb.eException = ex; ex.DefineSingletonMethod("exception", new RMethod(exc_new), -1); ex.DefineMethod("exception", new RMethod(exc_exception), -1); ex.DefineMethod("initialize", new RMethod(exc_initialize), -1); ex.DefineMethod("message", new RMethod(exc_to_s), 0); ex.DefineMethod("backtrace", new RMethod(exc_backtrace), 0); ex.DefineMethod("set_backtrace", new RMethod(exc_set_backtrace), 0); rb.eSystemExit = rb.DefineClass("SystemExit", ex); rb.eFatal = rb.DefineClass("Fatal", ex); rb.eInterrupt = rb.DefineClass("Interrupt", ex); rb.eSignal = rb.DefineClass("SignalException", ex); rb.eStandardError = rb.DefineClass("StandardError", ex); rb.eTypeError = rb.DefineClass("TypeError", rb.eStandardError); rb.eArgError = rb.DefineClass("ArgumentError", rb.eStandardError); rb.eIndexError = rb.DefineClass("IndexError", rb.eStandardError); rb.eRangeError = rb.DefineClass("RangeError", rb.eStandardError); rb.eScriptError = rb.DefineClass("ScriptError", ex); rb.eSyntaxError = rb.DefineClass("SyntaxError", rb.eScriptError); rb.eNameError = rb.DefineClass("NameError", rb.eScriptError); rb.eLoadError = rb.DefineClass("LoadError", rb.eScriptError); rb.eNotImpError = rb.DefineClass("NotImplementedError", rb.eScriptError); rb.eRuntimeError = rb.DefineClass("RuntimeError", rb.eStandardError); rb.eSecurityError = rb.DefineClass("SecurityError", rb.eStandardError); rb.eNoMemError = rb.DefineClass("NoMemoryError", ex); }
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); }