本文整理汇总了C#中NETRuby.NetRuby.DefineVirtualVariable方法的典型用法代码示例。如果您正苦于以下问题:C# NetRuby.DefineVirtualVariable方法的具体用法?C# NetRuby.DefineVirtualVariable怎么用?C# NetRuby.DefineVirtualVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NETRuby.NetRuby
的用法示例。
在下文中一共展示了NetRuby.DefineVirtualVariable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}