Package org.jruby.runtime
Class Block
java.lang.Object
org.jruby.runtime.Block
- All Implemented Interfaces:
BiFunction<ThreadContext,
,IRubyObject, IRubyObject> Function<ThreadContext,
,IRubyObject> ThreadContext.RecursiveFunctionEx<IRubyObject>
,FunctionOneOrTwoOrThree<ThreadContext,
,IRubyObject, IRubyObject, IRubyObject> TriFunction<ThreadContext,
IRubyObject, IRubyObject, IRubyObject>
public class Block
extends Object
implements FunctionOneOrTwoOrThree<ThreadContext,IRubyObject,IRubyObject,IRubyObject>, ThreadContext.RecursiveFunctionEx<IRubyObject>
Internal live representation of a block ({...} or do ... end).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Block
All Block variables should either refer to a real block or this NULL_BLOCK.final Block.Type
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocScope
(DynamicScope parentScope) apply
(ThreadContext context) apply
(ThreadContext context, IRubyObject arg0) apply
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) arity()
Deprecated.call
(ThreadContext context) call
(ThreadContext context, Block blockArg) call
(ThreadContext context, IRubyObject arg0) call
(ThreadContext context, IRubyObject[] args) call
(ThreadContext context, IRubyObject[] args, Block blockArg) call
(ThreadContext context, IRubyObject arg0, Block blockArg) call
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) call
(ThreadContext context, IRubyObject state, IRubyObject obj, boolean recur) call
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block blockArg) call
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) call
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block blockArg) cloneBlockAndBinding
(EvalType evalType) cloneBlockAndFrame
(EvalType evalType) cloneBlockAsType
(Block.Type newType) cloneBlockForEval
(IRubyObject self, EvalType evalType) deepCloneBlockForEval
(IRubyObject self, EvalType evalType) boolean
void
escape()
getBody()
getFrame()
Gets the frame.Gets the frame class.Retrieve the proc object associated with this blockint
hashCode()
boolean
final boolean
isGiven()
Is the current block a real yield'able block instead a null onevoid
setProcObject
(RubyProc procObject) Set the proc object associated with this blockvoid
setVisibility
(Visibility vis) yield
(ThreadContext context, IRubyObject value) yieldArray
(ThreadContext context, IRubyObject value, IRubyObject self) yieldNonArray
(ThreadContext context, IRubyObject value, IRubyObject self) yieldSpecific
(ThreadContext context) yieldSpecific
(ThreadContext context, IRubyObject arg0) yieldSpecific
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) yieldSpecific
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) yieldValues
(ThreadContext context, IRubyObject[] args) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jruby.util.func.FunctionOneOrTwoOrThree
andThen
-
Field Details
-
type
-
NULL_BLOCK
All Block variables should either refer to a real block or this NULL_BLOCK.
-
-
Constructor Details
-
Block
-
Block
-
Block
-
-
Method Details
-
allocScope
-
getEvalType
-
call
-
call
-
call
-
call
-
yieldSpecific
-
call
-
call
-
yieldSpecific
-
call
-
call
-
yieldSpecific
-
call
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
call
public IRubyObject call(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block blockArg) -
yieldSpecific
public IRubyObject yieldSpecific(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
yield
-
apply
- Specified by:
apply
in interfaceFunction<ThreadContext,
IRubyObject> - See Also:
-
apply
- Specified by:
apply
in interfaceBiFunction<ThreadContext,
IRubyObject, IRubyObject> - See Also:
-
apply
- Specified by:
apply
in interfaceTriFunction<ThreadContext,
IRubyObject, IRubyObject, IRubyObject> - See Also:
-
call
- Specified by:
call
in interfaceThreadContext.RecursiveFunctionEx<IRubyObject>
- See Also:
-
yieldNonArray
-
yieldArray
-
yieldValues
-
cloneBlock
-
cloneBlockAsType
-
cloneBlockAndBinding
-
cloneBlockAndBinding
-
cloneBlockAndFrame
-
cloneBlockAndFrame
-
cloneBlockForEval
-
deepCloneBlockForEval
-
arity
Deprecated.What is the arity of this block?- Returns:
- the arity
-
getSignature
-
getProcObject
Retrieve the proc object associated with this block- Returns:
- the proc or null if this has no proc associated with it
-
setProcObject
Set the proc object associated with this block- Parameters:
procObject
- the proc tu associate
-
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
-
getBody
-
getFrame
Gets the frame.- Returns:
- Returns a RubyFrame
-
getFrameClass
Gets the frame class.- Returns:
- the binding's frame's self class
-
isEscaped
public boolean isEscaped() -
escape
public void escape() -
getVisibility
-
setVisibility
-
equals
-
hashCode
public int hashCode()
-