Class: CodeExecuteInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- CodeExecuteInstruction
- Defined in:
- lib/instructions/code/code_execute.rb
Overview
pops the top item from the :code
stack; pushes it onto the :exec
stack so it is executed
needs: 1 :code
pushes: 1 :exec
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
Methods inherited from Instruction
all_instructions, #go, inherited, #initialize, #needs, #pushes, to_nudgecode
Constructor Details
This class inherits a constructor from Instruction
Instance Method Details
#cleanup ⇒ Object
23 24 25 |
# File 'lib/instructions/code/code_execute.rb', line 23 def cleanup pushes :exec, @result end |
#derive ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/instructions/code/code_execute.rb', line 15 def derive that_becomes = NudgeProgram.new(@arg) if that_becomes.parses? @result = NudgeProgram.new(@arg).linked_code else @result = CodeblockPoint.new([]) end end |
#preconditions? ⇒ Boolean
9 10 11 |
# File 'lib/instructions/code/code_execute.rb', line 9 def preconditions? needs :code, 1 end |
#setup ⇒ Object
12 13 14 |
# File 'lib/instructions/code/code_execute.rb', line 12 def setup @arg = @context.pop_value(:code) end |