Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
 
 package org.jruby.ast;
 
 import org.jruby.Ruby;
Represents a constant path which ends in a method (e.g. Foo::bar). Note: methods with explicit parameters (e.g. Foo::bar()) will be a CallNode.
public class Colon2MethodNode extends Colon2Node {
    public Colon2MethodNode(ISourcePosition positionNode leftNodeString name) {
        super(positionleftNodename);
        assert leftNode != null"class fooBar is not valid";
    }
    @Override
    public IRubyObject interpret(Ruby runtimeThreadContext contextIRubyObject selfBlock aBlock) {
        return RuntimeHelpers.invoke(context.interpret(runtimecontextselfaBlock), aBlock);
    }
    @Override
    public RubyString definition(Ruby runtimeThreadContext contextIRubyObject selfBlock aBlock) {
       try {
           if (hasMethod(.interpret(runtimecontextselfaBlock))) {
               return runtime.getDefinedMessage(.);
           }
        } catch (JumpException e) {
        }
        return null;
    }
    private boolean hasMethod(IRubyObject left) {
        return left.getMetaClass().isMethodBound(true);
    }
New to GrepCode? Check out our FAQ X