org.jruby.runtime
Class MethodBlock

java.lang.Object
  extended by org.jruby.runtime.BlockBody
      extended by org.jruby.runtime.ContextAwareBlockBody
          extended by org.jruby.runtime.MethodBlock

public abstract class MethodBlock
extends ContextAwareBlockBody

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


Field Summary
 
Fields inherited from class org.jruby.runtime.ContextAwareBlockBody
scope
 
Fields inherited from class org.jruby.runtime.BlockBody
argumentType, ARRAY, EMPTY_PARAMETER_LIST, MULTIPLE_ASSIGNMENT, NULL_BODY, SINGLE_RESTARG, ZERO_ARGS
 
Constructor Summary
MethodBlock(RubyMethod method, StaticScope staticScope)
           
 
Method Summary
 IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, Block.Type type)
           
abstract  IRubyObject callback(IRubyObject value, IRubyObject method, IRubyObject self, Block block)
           
static Block createMethodBlock(ThreadContext context, IRubyObject self, DynamicScope dynamicScope, MethodBlock body)
           
 java.lang.String getFile()
          Get the filename for this block
 int getLine()
          get The line number for this block
 RubyMethod getMethod()
           
protected  void post(ThreadContext context, Binding binding, Visibility visibility, Frame lastFrame)
           
protected  Frame pre(ThreadContext context, RubyModule klass, Binding binding)
           
 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.ContextAwareBlockBody
arity, cloneBlock, getStaticScope, setStaticScope
 
Methods inherited from class org.jruby.runtime.BlockBody
asArgumentType, call, call, call, call, call, call, call, call, call, getArgumentType, getArgumentTypeWackyHack, getParameterList, isGiven, prepareArgumentsForCall, yield, yield
 
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)
Overrides:
pre in class ContextAwareBlockBody

post

protected void post(ThreadContext context,
                    Binding binding,
                    Visibility visibility,
                    Frame lastFrame)
Overrides:
post in class ContextAwareBlockBody

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:

getFile

public java.lang.String getFile()
Description copied from class: BlockBody
Get the filename for this block

Specified by:
getFile in class BlockBody

getLine

public int getLine()
Description copied from class: BlockBody
get The line number for this block

Specified by:
getLine in class BlockBody

getMethod

public RubyMethod getMethod()


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