Example #1
0
 /** match_end */
 @JRubyMethod(name = "end", compat = CompatVersion.RUBY1_8)
 public IRubyObject end(ThreadContext context, IRubyObject index) {
   int i = RubyNumeric.num2int(index);
   Ruby runtime = context.getRuntime();
   int e = endCommon(runtime, i);
   return e < 0 ? runtime.getNil() : RubyFixnum.newFixnum(runtime, e);
 }
Example #2
0
 public final int backrefNumber(IRubyObject obj) {
   check();
   if (obj instanceof RubySymbol) {
     return nameToBackrefNumber((RubyString) ((RubySymbol) obj).id2name());
   } else if (obj instanceof RubyString) {
     return nameToBackrefNumber((RubyString) obj);
   } else {
     return RubyNumeric.num2int(obj);
   }
 }
Example #3
0
 /** match_offset */
 @JRubyMethod(name = "offset", compat = CompatVersion.RUBY1_8)
 public IRubyObject offset(ThreadContext context, IRubyObject index) {
   return offsetCommon(context, RubyNumeric.num2int(index), false);
 }