org.jruby.runtime
Class Block

java.lang.Object
  extended by org.jruby.runtime.Block

public class Block
extends java.lang.Object

Internal live representation of a block ({...} or do ... end).


Nested Class Summary
static class Block.Type
           
 
Field Summary
static int ARRAY
           
static int MULTIPLE_ASSIGNMENT
           
static Block NULL_BLOCK
          All Block variables should either refer to a real block or this NULL_BLOCK.
static int SINGLE_RESTARG
           
 Block.Type type
           
static int ZERO_ARGS
           
 
Constructor Summary
protected Block()
           
  Block(BlockBody body, Binding binding)
           
 
Method Summary
 Arity arity()
          What is the arity of this block?
protected  int arrayLength(IRubyObject node)
           
 IRubyObject call(ThreadContext context, IRubyObject[] args)
           
 Block cloneBlock()
           
 Binding getBinding()
           
 BlockBody getBody()
           
 Frame getFrame()
          Gets the frame.
 RubyProc getProcObject()
          Retrieve the proc object associated with this block
 boolean isGiven()
          Is the current block a real yield'able block instead a null one
 void setProcObject(RubyProc procObject)
          Set the proc object associated with this block
 IRubyObject yield(ThreadContext context, IRubyObject value)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO_ARGS

public static final int ZERO_ARGS
See Also:
Constant Field Values

MULTIPLE_ASSIGNMENT

public static final int MULTIPLE_ASSIGNMENT
See Also:
Constant Field Values

ARRAY

public static final int ARRAY
See Also:
Constant Field Values

SINGLE_RESTARG

public static final int SINGLE_RESTARG
See Also:
Constant Field Values

type

public Block.Type type

NULL_BLOCK

public static final Block NULL_BLOCK
All Block variables should either refer to a real block or this NULL_BLOCK.

Constructor Detail

Block

protected Block()

Block

public Block(BlockBody body,
             Binding binding)
Method Detail

call

public IRubyObject call(ThreadContext context,
                        IRubyObject[] args)

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value)

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value,
                         IRubyObject self,
                         RubyModule klass,
                         boolean aValue)

arrayLength

protected int arrayLength(IRubyObject node)

cloneBlock

public Block cloneBlock()

arity

public Arity arity()
What is the arity of this block?

Returns:
the arity

getProcObject

public RubyProc getProcObject()
Retrieve the proc object associated with this block

Returns:
the proc or null if this has no proc associated with it

setProcObject

public void setProcObject(RubyProc procObject)
Set the proc object associated with this block

Parameters:
procObject -

isGiven

public boolean isGiven()
Is the current block a real yield'able block instead a null one

Returns:
true if this is a valid block or false otherwise

getBinding

public Binding getBinding()

getBody

public BlockBody getBody()

getFrame

public Frame getFrame()
Gets the frame.

Returns:
Returns a RubyFrame


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