Пример #1
0
  @Override
  public RubyString definition(
      Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    IRubyObject backref = context.getBackRef();
    if (backref instanceof RubyMatchData) {
      if (!((RubyMatchData) backref).group(matchNumber).isNil()) {
        return runtime.getDefinedMessage(DefinedMessage.GLOBAL_VARIABLE);
      }
    }

    return null;
  }
Пример #2
0
 @Override
 public IRubyObject interpret(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return RubyRegexp.nth_match(matchNumber, context.getBackRef());
 }