Example #1
0
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return context.getConstantDefined(name)
       ? runtime.getDefinedMessage(DefinedMessage.CONSTANT)
       : null;
 }
Example #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);
   }
 }
Example #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;
  }
Example #5
0
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return runtime.getDefinedMessage(DefinedMessage.LOCAL_VARIABLE);
 }