Package org.jruby

Examples of org.jruby.RubyModule


    }
   
    public RubyModule popRubyClass() {
        int index = parentIndex;
        RubyModule[] stack = parentStack;
        RubyModule ret = stack[index];
        stack[index] = null;
        parentIndex = index - 1;
        return ret;
    }
View Full Code Here


    }
   
    public RubyModule getRubyClass() {
        assert !(parentIndex == -1) : "Trying to get RubyClass from empty stack";
       
        RubyModule parentModule = parentStack[parentIndex];
       
        return parentModule.getNonIncludedClass();
    }
View Full Code Here

        return parentModule.getNonIncludedClass();
    }
   
    public RubyModule getImmediateBindingRubyClass() {
        int index = parentIndex;
        RubyModule parentModule = null;
        parentModule = parentStack[index];
        return parentModule.getNonIncludedClass();
    }
View Full Code Here

        return parentModule.getNonIncludedClass();
    }

    public RubyModule getEvalBindingRubyClass() {
        int index = parentIndex;
        RubyModule parentModule = null;
        if(index == 0) {
            parentModule = parentStack[index];
        } else {
            parentModule = parentStack[index-1];
        }
        return parentModule.getNonIncludedClass();
    }
View Full Code Here

    public boolean getConstantDefined(String internedName) {
        IRubyObject result;
       
        // flipped from while to do to search current class first
        for (StaticScope scope = getCurrentScope().getStaticScope(); scope != null; scope = scope.getPreviousCRefScope()) {
            RubyModule module = scope.getModule();
            if ((result = module.fastFetchConstant(internedName)) != null) {
                if (result != RubyObject.UNDEF) return true;
                return runtime.getLoadService().autoloadFor(module.getName() + "::" + internedName) != null;
            }
        }
       
        return getCurrentScope().getStaticScope().getModule().fastIsConstantDefined(internedName);
    }
View Full Code Here

    /**
     * Used by the evaluator and the compiler to set a constant by name
     * This is for a null const decl
     */
    public IRubyObject setConstantInCurrent(String internedName, IRubyObject result) {
        RubyModule module;

        if ((module = getCurrentScope().getStaticScope().getModule()) != null) {
            module.fastSetConstant(internedName, result);
            return result;
        }

        // TODO: wire into new exception handling mechanism
        throw runtime.newTypeError("no class/module to define constant");
View Full Code Here

     */
    public IRubyObject setConstantInModule(String internedName, IRubyObject target, IRubyObject result) {
        if (!(target instanceof RubyModule)) {
            throw runtime.newTypeError(target.toString() + " is not a class/module");
        }
        RubyModule module = (RubyModule)target;
        module.fastSetConstant(internedName, result);
       
        return result;
    }
View Full Code Here

        popFrame();
    }
   
    public void preMethodFrameAndScope(RubyModule clazz, String name, IRubyObject self, Block block,
            StaticScope staticScope) {
        RubyModule implementationClass = staticScope.getModule();
        // FIXME: This is currently only here because of some problems with IOOutputStream writing to a "bare" runtime without a proper scope
        if (implementationClass == null) {
            implementationClass = clazz;
        }
        pushCallFrame(clazz, name, self, block);
View Full Code Here

        pushRubyClass(implementationClass);
    }
   
    public void preMethodFrameAndDummyScope(RubyModule clazz, String name, IRubyObject self, Block block,
            StaticScope staticScope) {
        RubyModule implementationClass = staticScope.getModule();
        // FIXME: This is currently only here because of some problems with IOOutputStream writing to a "bare" runtime without a proper scope
        if (implementationClass == null) {
            implementationClass = clazz;
        }
        pushCallFrame(clazz, name, self, block);
View Full Code Here

        popFrame();
        popRubyClass();
    }
   
    public void preMethodScopeOnly(RubyModule clazz, StaticScope staticScope) {
        RubyModule implementationClass = staticScope.getModule();
        // FIXME: This is currently only here because of some problems with IOOutputStream writing to a "bare" runtime without a proper scope
        if (implementationClass == null) {
            implementationClass = clazz;
        }
        pushScope(DynamicScope.newDynamicScope(staticScope));
View Full Code Here

TOP

Related Classes of org.jruby.RubyModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.