org.jruby.runtime
Class MethodBlock

java.lang.Object
  extended by org.jruby.runtime.BlockBody
      extended by org.jruby.runtime.MethodBlock
All Implemented Interfaces:
JumpTarget

public abstract class MethodBlock
extends BlockBody

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


Field Summary
 
Fields inherited from class org.jruby.runtime.BlockBody
argumentType, ARRAY, MULTIPLE_ASSIGNMENT, NULL_BODY, SINGLE_RESTARG, ZERO_ARGS
 
Constructor Summary
MethodBlock(RubyMethod method, StaticScope staticScope)
           
 
Method Summary
 Arity arity()
          What is the arity of this block?
 IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, Block.Type type)
           
abstract  IRubyObject callback(IRubyObject value, IRubyObject method, IRubyObject self, Block block)
           
 Block cloneBlock(Binding binding)
           
static Block createMethodBlock(ThreadContext context, IRubyObject self, DynamicScope dynamicScope, MethodBlock body)
           
 StaticScope getStaticScope()
           
protected  void post(ThreadContext context, Binding binding, Frame lastFrame)
           
protected  Frame pre(ThreadContext context, RubyModule klass, Binding binding)
           
 void setStaticScope(StaticScope newScope)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, Binding binding, Block.Type type)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue, Binding binding, Block.Type type)
          Yield to this block, usually passed to the current call.
 IRubyObject yieldSpecific(ThreadContext context, Binding binding, Block.Type type)
           
 IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, Binding binding, Block.Type type)
           
 IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Binding binding, Block.Type type)
           
 IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Binding binding, Block.Type type)
           
 
Methods inherited from class org.jruby.runtime.BlockBody
asArgumentType, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, call, getArgumentType, getArgumentTypeWackyHack, isGiven, prepareArgumentsForCall, yieldSpecific, yieldSpecific, yieldSpecific, yieldSpecific, yieldSpecific, yieldSpecific, yieldSpecific
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodBlock

public MethodBlock(RubyMethod method,
                   StaticScope staticScope)
Method Detail

createMethodBlock

public static Block createMethodBlock(ThreadContext context,
                                      IRubyObject self,
                                      DynamicScope dynamicScope,
                                      MethodBlock body)

callback

public abstract IRubyObject callback(IRubyObject value,
                                     IRubyObject method,
                                     IRubyObject self,
                                     Block block)

call

public IRubyObject call(ThreadContext context,
                        IRubyObject[] args,
                        Binding binding,
                        Block.Type type)
Overrides:
call in class BlockBody

pre

protected Frame pre(ThreadContext context,
                    RubyModule klass,
                    Binding binding)

post

protected void post(ThreadContext context,
                    Binding binding,
                    Frame lastFrame)

yieldSpecific

public IRubyObject yieldSpecific(ThreadContext context,
                                 Binding binding,
                                 Block.Type type)
Overrides:
yieldSpecific in class BlockBody

yieldSpecific

public IRubyObject yieldSpecific(ThreadContext context,
                                 IRubyObject arg0,
                                 Binding binding,
                                 Block.Type type)
Overrides:
yieldSpecific in class BlockBody

yieldSpecific

public IRubyObject yieldSpecific(ThreadContext context,
                                 IRubyObject arg0,
                                 IRubyObject arg1,
                                 Binding binding,
                                 Block.Type type)
Overrides:
yieldSpecific in class BlockBody

yieldSpecific

public IRubyObject yieldSpecific(ThreadContext context,
                                 IRubyObject arg0,
                                 IRubyObject arg1,
                                 IRubyObject arg2,
                                 Binding binding,
                                 Block.Type type)
Overrides:
yieldSpecific in class BlockBody

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value,
                         Binding binding,
                         Block.Type type)
Specified by:
yield in class BlockBody

yield

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

Specified by:
yield in class BlockBody
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:

getStaticScope

public StaticScope getStaticScope()
Specified by:
getStaticScope in class BlockBody

setStaticScope

public void setStaticScope(StaticScope newScope)
Specified by:
setStaticScope in class BlockBody

cloneBlock

public Block cloneBlock(Binding binding)
Specified by:
cloneBlock in class BlockBody

arity

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

Specified by:
arity in class BlockBody
Returns:
the arity


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