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 Block NULL_BLOCK
          All Block variables should either refer to a real block or this NULL_BLOCK.
 Block.Type type
           
 
Constructor Summary
protected Block()
           
  Block(BlockBody body, Binding binding)
           
 
Method Summary
 Arity arity()
          What is the arity of this block?
 IRubyObject call(ThreadContext context, IRubyObject[] args)
           
 IRubyObject call(ThreadContext context, IRubyObject[] args, Block block)
           
 Block cloneBlock()
           
 void escape()
           
 Binding getBinding()
           
 BlockBody getBody()
           
 Frame getFrame()
          Gets the frame.
 RubyProc getProcObject()
          Retrieve the proc object associated with this block
 boolean isEscaped()
           
 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, boolean aValue)
           
 IRubyObject yield(ThreadContext context, IRubyObject value)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, boolean aValue)
           
 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

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)

call

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

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value)

yield

public IRubyObject yield(ThreadContext context,
                         boolean aValue)

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value,
                         boolean aValue)

yield

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

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 final 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

isEscaped

public boolean isEscaped()

escape

public void escape()


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