static internal object initialize(RBasic r, params object[] args) { if (args.Length < 1 || args.Length > 3) { throw new eArgError("wrong # of argument"); } RegexOptions flag = RegexOptions.None; if (args.Length >= 2) { if (args[1] is int || args[1] is RegexOptions) { flag = (RegexOptions)(int)args[1]; } else if (args[1] is RFixnum) { flag = (RegexOptions)((RFixnum)args[1]).ToInt(); } else if (RBasic.RTest(args[1])) { flag = RegexOptions.IgnoreCase; } } if (args.Length == 3) { // ignore char set } NetRuby ruby = r.ruby; RRegexp self = (RRegexp)r; if (args[0] is RRegexp) { RRegexp re = (RRegexp)args[0]; re.Check(); self.Initialize(re, flag); } else { string p = RString.ToString(ruby, args[0]); self.Initialize(p, flag); } return(self); }
public override bool Equals(object o) { if (base.Equals(o)) { return(true); } if (o is RRegexp == false) { return(false); } RRegexp re = (RRegexp)o; Check(); re.Check(); if (re.regex.ToString() != regex.ToString() || re.regex.Options != regex.Options) { return(false); } return(true); }