Package org.jruby.runtime

Examples of org.jruby.runtime.Block


        arg3 = args.get(2);
    }

    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        Block block = getBlock(context, self);
       
        return callAdapter.callIter(context, self, self,
                arg1.interpret(runtime, context, self, aBlock),
                arg2.interpret(runtime, context, self, aBlock),
                arg3.interpret(runtime, context, self, aBlock), block);
View Full Code Here


            IRubyObject tmp = begin.checkStringType();
            if (!tmp.isNil()) {
                if (unit == 0) throw runtime.newArgumentError("step can't be 0");
                // rb_iterate((VALUE(*)_((VALUE)))str_step, (VALUE)args, step_i, (VALUE)iter);
                StepBlockCallBack callback = new StepBlockCallBack(block, RubyFixnum.one(runtime), step);
                Block blockCallback = CallBlock.newCallClosure(this, runtime.getRange(), Arity.singleArgument(), callback, context);
                ((RubyString)tmp).upto(context, end, isExclusive, blockCallback);
            } else if (begin instanceof RubyNumeric) {
                if (equalInternal(context, step, RubyFixnum.zero(runtime))) {
                    throw runtime.newArgumentError("step can't be 0");
                }
View Full Code Here

     */
    @JRubyMethod(name = "to_proc", frame = true)
    public IRubyObject to_proc(ThreadContext context, Block unusedBlock) {
        Ruby runtime = context.getRuntime();
        CallbackFactory f = runtime.callbackFactory(RubyMethod.class);
        Block block = MethodBlock.createMethodBlock(context, context.getCurrentScope(),
                f.getBlockMethod("bmcall"), this, runtime.getTopSelf());
       
        while (true) {
            try {
                // FIXME: We should not be regenerating this over and over
View Full Code Here

    }
       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(context, self);

        return callAdapter.callIter(context, self, receiver,
                arg1.interpret(runtime, context, self, aBlock),
                arg2.interpret(runtime, context, self, aBlock), block);
    }
View Full Code Here

    }
       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(runtime, context, self, aBlock);
           
        return callAdapter.call(context, self, receiver,
                arg1.interpret(runtime, context, self, aBlock), block);
    }
View Full Code Here

        arg2 = args.get(1);
    }

    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        Block block = getBlock(runtime, context, self, aBlock);
       
        return callAdapter.call(context, self, self,
                arg1.interpret(runtime, context, self, aBlock),
                arg2.interpret(runtime, context, self, aBlock), block);
    }
View Full Code Here

    }
   
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject arg = getArgsNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(context, self);
       
        if (arg instanceof RubyArray) {
            RubyArray nodes = (RubyArray) arg;
           
            switch (nodes.size()) {
View Full Code Here

    }
       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        Block block = getBlock(context, self);
        IRubyObject[] args = ((ArrayNode) getArgsNode()).interpretPrimitive(runtime, context, self, aBlock);
       
        while (true) {
            try {
                return callAdapter.call(context, self, receiver, args, block);
            } catch (JumpException.RetryJump rj) {
                // allow loop to retry
            } finally {
                block.escape();
            }
        }   
    }
View Full Code Here

        arg2 = args.get(1);
    }

    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        Block block = getBlock(context, self);
       
        return callAdapter.callIter(context, self, self,
                arg1.interpret(runtime, context, self, aBlock),
                arg2.interpret(runtime, context, self, aBlock), block);
    }
View Full Code Here

       
    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
        IRubyObject[] args = ((ArrayNode) getArgsNode()).interpretPrimitive(runtime, context, self, aBlock);
        Block block = getBlock(runtime, context, self, aBlock);
       
        return callAdapter.call(context, self, receiver, args, block);
    }
View Full Code Here

TOP

Related Classes of org.jruby.runtime.Block

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.