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

    • method

      public String method
    • filename

      public String filename
    • line

      public int line
    • 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
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getEvalScope

      public final DynamicScope getEvalScope(Ruby runtime)
    • getBacktrace

      @Deprecated public BacktraceElement getBacktrace()
      Deprecated.
    • dup

      public Binding dup(ThreadContext context)
      Duplicate this binding and setup the proper cloned instance of the eval scope so that any previously captured variables still exist but are not shared with the original binding.
      Parameters:
      context - the current thread context
      Returns:
      the duplicated binding