コード例 #1
0
ファイル: NthRefNode.java プロジェクト: xb/jruby
  @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
ファイル: NthRefNode.java プロジェクト: xb/jruby
 @Override
 public IRubyObject interpret(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return RubyRegexp.nth_match(matchNumber, context.getBackRef());
 }