Class Binding

java.lang.Object
org.jruby.runtime.Binding

public class Binding extends Object
Internal live representation of a block ({...} or do ... end).
  • Field Details

    • frame

      private final Frame frame
      frame of method which defined this block
    • method

      public String method
    • filename

      public String filename
    • line

      public int line
    • visibility

      private Visibility visibility
    • self

      private IRubyObject self
      'self' at point when the block is defined
    • dynamicScope

      private final DynamicScope dynamicScope
      A reference to all variable values (and names) that are in-scope for this block.
    • evalScope

      private DynamicScope evalScope
      Binding-local scope for 1.9 mode.
    • evalScopeBinding

      private Binding 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

      private DynamicScope dummyScope
    • DUMMY

      @Deprecated public static final Binding DUMMY
      Deprecated.
  • Constructor Details

  • Method Details

    • cloneForEval

      public Binding 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

      public Binding 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.
      Overrides:
      clone in class Object
      Returns:
      a new cloned Binding
    • getVisibility

      public Visibility getVisibility()
    • setVisibility

      public void setVisibility(Visibility visibility)
    • getSelf

      public IRubyObject getSelf()
    • setSelf

      public void setSelf(IRubyObject self)
    • getDynamicScope

      public DynamicScope 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

      public DynamicScope getDummyScope(StaticScope staticScope)
    • getFrame

      public Frame getFrame()
      Gets the frame.
      Returns:
      Returns a RubyFrame
    • getFile

      public String getFile()
    • setFile

      public void setFile(String filename)
    • getLine

      public int getLine()
    • setLine

      public void setLine(int line)
    • getMethod

      public String getMethod()
    • setMethod

      public void setMethod(String method)
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • getEvalScope

      public final DynamicScope getEvalScope(Ruby runtime)
    • getBacktrace

      @Deprecated public BacktraceElement getBacktrace()
      Deprecated.