Class: CodeFromNameInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- CodeFromNameInstruction
- Defined in:
- lib/instructions/conversion/code_from_name.rb
Overview
pops the top :name
item; pushes a new :code
item, with value equal to the :name
item’s blueprint
needs: 1 :name
pushes: 1 :code
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
22 23 24 |
# File 'lib/instructions/conversion/code_from_name.rb', line 22 def cleanup pushes :code, @result end |
#derive ⇒ Object
19 20 21 |
# File 'lib/instructions/conversion/code_from_name.rb', line 19 def derive @result = ValuePoint.new("code", "ref #{@arg}") end |
#preconditions? ⇒ Boolean
13 14 15 |
# File 'lib/instructions/conversion/code_from_name.rb', line 13 def preconditions? needs :name, 1 end |
#setup ⇒ Object
16 17 18 |
# File 'lib/instructions/conversion/code_from_name.rb', line 16 def setup @arg = @context.pop(:name).name end |