Exemplo n.º 1
0
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return context.getConstantDefined(name)
       ? runtime.getDefinedMessage(DefinedMessage.CONSTANT)
       : null;
 }
Exemplo n.º 2
0
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   if (!context.runtime.is1_9()) {
     return super.definition(runtime, context, self, aBlock);
   } else {
     return runtime.getDefinedMessage(DefinedMessage.EXPRESSION);
   }
 }
Exemplo n.º 3
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;
  }
  @Override
  public RubyString definition(
      Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    IRubyObject lastError = context.getErrorInfo();
    try {
      if (Helpers.isModuleAndHasConstant(
          leftNode.interpret(runtime, context, self, aBlock), name)) {
        return runtime.getDefinedMessage(DefinedMessage.CONSTANT);
      }
    } catch (JumpException e) {
      // replace lastError
      context.setErrorInfo(lastError);
    }

    return null;
  }
Exemplo n.º 5
0
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return runtime.getDefinedMessage(DefinedMessage.LOCAL_VARIABLE);
 }