Class EmbedEvalUnitImpl

java.lang.Object
org.jruby.embed.internal.EmbedEvalUnitImpl
All Implemented Interfaces:
EmbedEvalUnit, JavaEmbedUtils.EvalUnit

public class EmbedEvalUnitImpl extends Object implements EmbedEvalUnit
Implementation of org.jruby.javasupport.JavaEmbedUtils.EvalUnit for embeddiing. This class is created when a Ruby script has been parsed. Once parsed, the script is ready to run many times without parsing.

Users do not instantiate explicitly. Instead, they can get the instance by parsing Ruby script by parse method of ScriptingContainer.

Author:
Yoko Harada <[email protected]>
  • Method Details

    • getNode

      @Deprecated public Node getNode()
      Deprecated.
      Returns a root node of parsed Ruby script.
      Specified by:
      getNode in interface EmbedEvalUnit
      Returns:
      a root node of parsed Ruby script
    • getLocalVarScope

      public DynamicScope getLocalVarScope()
      Returns a ManyVarsDynamicScope used to parse a script. A returned value is used to inject Ruby's local variable when script is evaluated.
      Specified by:
      getLocalVarScope in interface EmbedEvalUnit
      Returns:
      a scope to refer local variables
    • run

      public IRubyObject run()
      Evaluates a Ruby script, which has been parsed before.
      Specified by:
      run in interface JavaEmbedUtils.EvalUnit
      Returns:
      results of executing this evaluation unit