org.jruby.runtime
Class CallBlock

java.lang.Object
  extended byorg.jruby.runtime.Block
      extended byorg.jruby.runtime.CallBlock

public class CallBlock
extends Block

A Block implemented using a Java-based BlockCallback implementation rather than with an ICallable. For lightweight block logic within Java code.


Field Summary
 
Fields inherited from class org.jruby.runtime.Block
cref, dynamicScope, frame, isLambda, klass, NULL_BLOCK, visibility
 
Constructor Summary
CallBlock(IRubyObject self, RubyModule imClass, Arity arity, BlockCallback callback, ThreadContext ctx)
           
 
Method Summary
 Arity arity()
          What is the arity of this block?
 IRubyObject call(ThreadContext context, IRubyObject[] args)
           
 Block cloneBlock()
           
 IRubyObject yield(ThreadContext context, IRubyObject value)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue)
          Yield to this block, usually passed to the current call.
 
Methods inherited from class org.jruby.runtime.Block
createBinding, createBlock, getCRef, getDynamicScope, getFrame, getKlass, getProcObject, getVisibility, isGiven, post, pre, setProcObject, setSelf, setVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallBlock

public CallBlock(IRubyObject self,
                 RubyModule imClass,
                 Arity arity,
                 BlockCallback callback,
                 ThreadContext ctx)
Method Detail

call

public IRubyObject call(ThreadContext context,
                        IRubyObject[] args)
Overrides:
call in class Block

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value)
Overrides:
yield in class Block

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value,
                         IRubyObject self,
                         RubyModule klass,
                         boolean aValue)
Yield to this block, usually passed to the current call.

Overrides:
yield in class Block
Parameters:
context - represents the current thread-specific data
value - The value to yield, either a single value or an array of values
self - The current self
klass -
aValue - Should value be arrayified or not?
Returns:

cloneBlock

public Block cloneBlock()
Overrides:
cloneBlock in class Block

arity

public Arity arity()
Description copied from class: Block
What is the arity of this block?

Overrides:
arity in class Block
Returns:
the arity


Copyright © 2002-2007 JRuby Team. All Rights Reserved.