Package org.jruby.runtime.builtin

Examples of org.jruby.runtime.builtin.IRubyObject


        binding.getFrame().setVisibility(vis);
        context.postYield(binding, lastFrame);
    }
   
    public IRubyObject yield(ThreadContext context, IRubyObject value, Binding binding, Block.Type type) {
        IRubyObject self = prepareSelf(binding);
       
        Visibility oldVis = binding.getFrame().getVisibility();
        Frame lastFrame = pre(context, null, binding);

        try {
View Full Code Here


            }
        }
    }
   
    private IRubyObject prepareSelf(Binding binding) {
        IRubyObject self = binding.getSelf();
        binding.getFrame().setSelf(self);
       
        return self;
    }
View Full Code Here

        public Object getJavaifiedValue() {
            return JavaUtil.convertRubyToJava(value);
        }

        public Object setValue(Object value) {
            IRubyObject oldValue = this.value;
            if (value instanceof IRubyObject) {
                this.value = (IRubyObject)value;
            } else {
                throw new UnsupportedOperationException("directEntrySet() doesn't support setValue for non IRubyObject instance entries, convert them manually or use entrySet() instead");
            }
View Full Code Here

        this.hasMultipleArgsHead = hasMultipleArgsHead;
    }

    @Override
    public IRubyObject yield(ThreadContext context, IRubyObject value, Binding binding, Block.Type type) {
        IRubyObject self = prepareSelf(binding);

        IRubyObject realArg = setupBlockArg(context.getRuntime(), value, self);
        Visibility oldVis = binding.getFrame().getVisibility();
        Frame lastFrame = pre(context, null, binding);
       
        try {
            return callback.call(context, self, realArg);
View Full Code Here

    public IRubyObject yield(ThreadContext context, IRubyObject args, IRubyObject self, RubyModule klass, boolean aValue, Binding binding, Block.Type type) {
        if (klass == null) {
            self = prepareSelf(binding);
        }

        IRubyObject realArg = aValue ?
                setupBlockArgs(context, args, self) : setupBlockArg(context.getRuntime(), args, self);
        Visibility oldVis = binding.getFrame().getVisibility();
        Frame lastFrame = pre(context, klass, binding);
       
        try {
View Full Code Here

            post(context, binding, oldVis, lastFrame);
        }
    }
   
    private IRubyObject prepareSelf(Binding binding) {
        IRubyObject self = binding.getSelf();
        binding.getFrame().setSelf(self);
       
        return self;
    }
View Full Code Here

                    JarEntry entry = in.getNextJarEntry();
                    while (entry != null && !entry.getName().equals(rubyInit)) {
                        entry = in.getNextJarEntry();
                    }
                    if (entry != null) {
                        IRubyObject old = runtime.getGlobalVariables().isDefined("$JAR_URL") ? runtime.getGlobalVariables().get("$JAR_URL") : runtime.getNil();
                        try {
                            runtime.getGlobalVariables().set("$JAR_URL", runtime.newString("jar:" + jarFile + "!/"));
                            runtime.loadFile("init", in, wrap);
                        } finally {
                            runtime.getGlobalVariables().set("$JAR_URL", old);
View Full Code Here

    }

    @JRubyMethod(name = "define_finalizer", required = 1, optional = 1, frame = true, module = true, visibility = Visibility.PRIVATE)
    public static IRubyObject define_finalizer(IRubyObject recv, IRubyObject[] args, Block block) {
        Ruby runtime = recv.getRuntime();
        IRubyObject finalizer = null;
        if (args.length == 2) {
            finalizer = args[1];
            if (!finalizer.respondsTo("call")) {
                throw runtime.newArgumentError("wrong type argument "
                        + finalizer.getType() + " (should be callable)");
            }
        } else {
            finalizer = runtime.newProc(Block.Type.PROC, block);
        }
        IRubyObject obj = args[0];
        runtime.getObjectSpace().addFinalizer(obj, finalizer);
        return runtime.newArray(runtime.newFixnum(runtime.getSafeLevel()), finalizer);
    }
View Full Code Here

            return runtime.getNil();
        } else if (longId % 2 != 0) {
            // odd
            return runtime.newFixnum((longId - 1) / 2);
        } else {
            IRubyObject object = runtime.getObjectSpace().id2ref(longId);
            if (object == null) {
                return runtime.getNil();
            }
            return object;
        }
View Full Code Here

            if (!runtime.isObjectSpaceEnabled()) {
                throw runtime.newRuntimeError("ObjectSpace is disabled; each_object will only work with Class, pass +O to enable");
            }
            Iterator iter = recv.getRuntime().getObjectSpace().iterator(rubyClass);
           
            IRubyObject obj = null;
            while ((obj = (IRubyObject)iter.next()) != null) {
                count++;
                block.yield(context, obj);
            }
        } else {
            Iterator iter = runtime.getObject().subclasses(true).iterator();
           
            while (iter.hasNext()) {
                IRubyObject obj = (IRubyObject)iter.next();
                if (obj instanceof RubyClass && ((RubyClass)obj).isIncluded()) {
                    continue;
                }
                count++;
                block.yield(context, obj);
View Full Code Here

TOP

Related Classes of org.jruby.runtime.builtin.IRubyObject

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.