Package org.jruby.runtime
Class Binding
java.lang.Object
org.jruby.runtime.Binding
Internal live representation of a block ({...} or do ... end).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BindingDeprecated.private DynamicScopeprivate final DynamicScopeA reference to all variable values (and names) that are in-scope for this block.private DynamicScopeBinding-local scope for 1.9 mode.private BindingLocation of eval scope.private final Frameframe of method which defined this blockintprivate IRubyObject'self' at point when the block is definedprivate Visibility -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBinding(IRubyObject self) Binding(IRubyObject self, DynamicScope dynamicScope) Binding(IRubyObject self, Frame frame, Visibility visibility) Binding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope) Binding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope, String method, String filename, int line) privateBinding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope, String method, String filename, int line, DynamicScope dummyScope) Binding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope, BacktraceElement backtrace) Deprecated.Binding(Frame frame, DynamicScope dynamicScope, String method, String filename, int line) Binding(Frame frame, DynamicScope dynamicScope, BacktraceElement backtrace) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionclone()Clone the binding.Clone the binding, but maintain a reference to the original "eval binding" to continue sharing eval context.booleanDeprecated.getDummyScope(StaticScope staticScope) Gets the dynamicVariables that are local to this block.final DynamicScopegetEvalScope(Ruby runtime) getFile()getFrame()Gets the frame.intgetLine()getSelf()voidvoidsetLine(int line) voidvoidsetSelf(IRubyObject self) voidsetVisibility(Visibility visibility)
-
Field Details
-
frame
frame of method which defined this block -
method
-
filename
-
line
public int line -
visibility
-
self
'self' at point when the block is defined -
dynamicScope
A reference to all variable values (and names) that are in-scope for this block. -
evalScope
Binding-local scope for 1.9 mode. -
evalScopeBinding
Location of eval scope. Because bindings are usually cloned before used for eval, we indirect the reference of the eval scope through another Binding reference, allowing us to share the same eval scope across multiple cloned Binding instances. -
dummyScope
-
DUMMY
Deprecated.
-
-
Constructor Details
-
Binding
public Binding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope, String method, String filename, int line) -
Binding
private Binding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope, String method, String filename, int line, DynamicScope dummyScope) -
Binding
-
Binding
-
Binding
-
Binding
-
Binding
-
Binding
-
Binding
@Deprecated public Binding(IRubyObject self, Frame frame, Visibility visibility, DynamicScope dynamicScope, BacktraceElement backtrace) Deprecated. -
Binding
Deprecated.
-
-
Method Details
-
cloneForEval
Clone the binding, but maintain a reference to the original "eval binding" to continue sharing eval context.- Returns:
- a new Binding with shared eval context
-
clone
Clone the binding. The frame will be duplicated, and eval context will point to the new binding, but other fields will be copied as-is. -
getVisibility
-
setVisibility
-
getSelf
-
setSelf
-
getDynamicScope
Gets the dynamicVariables that are local to this block. Parent dynamic scopes are also accessible via the current dynamic scope.- Returns:
- Returns all relevant variable scoping information
-
getDummyScope
-
getFrame
Gets the frame.- Returns:
- Returns a RubyFrame
-
getFile
-
setFile
-
getLine
public int getLine() -
setLine
public void setLine(int line) -
getMethod
-
setMethod
-
equals
-
getEvalScope
-
getBacktrace
Deprecated.
-