Examples of IRubyObject


Examples of org.jruby.runtime.builtin.IRubyObject

                }
                break;
            } else if (other instanceof RubyBignum) {
                RubyBignum otherBignum = (RubyBignum)other;
                if (otherBignum.value.signum() >= 0) {
                    IRubyObject tmp = otherBignum.checkShiftDown(this);
                    if (!tmp.isNil()) return tmp;
                } else {
                    neg = true;
                }
                shift = big2long(otherBignum);
                break;
View Full Code Here

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

Examples of org.jruby.runtime.builtin.IRubyObject

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

Examples of org.jruby.runtime.builtin.IRubyObject

        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

Examples of org.jruby.runtime.builtin.IRubyObject

        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

Examples of org.jruby.runtime.builtin.IRubyObject

    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

Examples of org.jruby.runtime.builtin.IRubyObject

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

Examples of org.jruby.runtime.builtin.IRubyObject

                    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

Examples of org.jruby.runtime.builtin.IRubyObject

    }

    @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

Examples of org.jruby.runtime.builtin.IRubyObject

            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
TOP
Copyright © 2018 www.massapi.com. 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.