Class: Gloo::Exec::ExecEnv
- Inherits:
-
Object
- Object
- Gloo::Exec::ExecEnv
- Defined in:
- lib/gloo/exec/exec_env.rb
Constant Summary collapse
- VERB_STACK =
'verbs'.freeze
- ACTION_STACK =
'actions'.freeze
- SCRIPT_STACK =
'scripts'.freeze
- HERE_STACK =
'here'.freeze
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#here ⇒ Object
Returns the value of attribute here.
-
#running_script ⇒ Object
readonly
Returns the value of attribute running_script.
-
#scripts ⇒ Object
Returns the value of attribute scripts.
-
#verbs ⇒ Object
Returns the value of attribute verbs.
Instance Method Summary collapse
-
#here_obj ⇒ Object
Get the here object.
-
#initialize(engine) ⇒ ExecEnv
constructor
Set up the execution environment.
-
#pop_action ⇒ Object
Pop an action off the stack.
-
#pop_script ⇒ Object
Pop a script off the stack.
-
#push_action(action) ⇒ Object
Push an action onto the stack.
-
#push_script(script) ⇒ Object
Push a script onto the stack.
Constructor Details
#initialize(engine) ⇒ ExecEnv
Set up the execution environment.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gloo/exec/exec_env.rb', line 23 def initialize( engine ) @engine = engine @engine.log.debug 'exec env intialized...' @running_script = nil @verbs = Gloo::Exec::Stack.new( @engine, VERB_STACK ) @actions = Gloo::Exec::Stack.new( @engine, ACTION_STACK ) @scripts = Gloo::Exec::Stack.new( @engine, SCRIPT_STACK ) @here = Gloo::Exec::Stack.new( @engine, HERE_STACK ) end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
12 13 14 |
# File 'lib/gloo/exec/exec_env.rb', line 12 def actions @actions end |
#here ⇒ Object
Returns the value of attribute here.
12 13 14 |
# File 'lib/gloo/exec/exec_env.rb', line 12 def here @here end |
#running_script ⇒ Object (readonly)
Returns the value of attribute running_script.
13 14 15 |
# File 'lib/gloo/exec/exec_env.rb', line 13 def running_script @running_script end |
#scripts ⇒ Object
Returns the value of attribute scripts.
12 13 14 |
# File 'lib/gloo/exec/exec_env.rb', line 12 def scripts @scripts end |
#verbs ⇒ Object
Returns the value of attribute verbs.
12 13 14 |
# File 'lib/gloo/exec/exec_env.rb', line 12 def verbs @verbs end |
Instance Method Details
#here_obj ⇒ Object
Get the here object.
37 38 39 40 41 |
# File 'lib/gloo/exec/exec_env.rb', line 37 def here_obj return nil if @here.stack.empty? return @here.stack.last end |
#pop_action ⇒ Object
Pop an action off the stack.
72 73 74 75 |
# File 'lib/gloo/exec/exec_env.rb', line 72 def pop_action @actions.pop # @here.pop end |
#pop_script ⇒ Object
Pop a script off the stack.
55 56 57 58 59 |
# File 'lib/gloo/exec/exec_env.rb', line 55 def pop_script @scripts.pop @running_script = @scripts.stack.last @here.pop end |
#push_action(action) ⇒ Object
Push an action onto the stack.
64 65 66 67 |
# File 'lib/gloo/exec/exec_env.rb', line 64 def push_action( action ) @actions.push action # @here.push action.to end |
#push_script(script) ⇒ Object
Push a script onto the stack.
46 47 48 49 50 |
# File 'lib/gloo/exec/exec_env.rb', line 46 def push_script( script ) @scripts.push script @running_script = script @here.push script.obj end |