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