Class: CodeInstructionsInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- CodeInstructionsInstruction
- Defined in:
- lib/instructions/code/code_instructions.rb
Overview
pushes a new :code
item whose value is a block containing one call to every Instruction active in the context
note: the order of instructions is determined by the order they appear in the context’s library
needs: nothing
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
24 25 26 |
# File 'lib/instructions/code/code_instructions.rb', line 24 def cleanup pushes :code, @result end |
#derive ⇒ Object
18 19 20 21 22 |
# File 'lib/instructions/code/code_instructions.rb', line 18 def derive all_instructions = @context.instructions list_as_block = all_instructions.inject("block {") {|b,i| b + " do #{i.to_nudgecode}"} + "}" @result = ValuePoint.new("code", list_as_block) end |
#preconditions? ⇒ Boolean
11 12 13 |
# File 'lib/instructions/code/code_instructions.rb', line 11 def preconditions? true end |
#setup ⇒ Object
15 16 |
# File 'lib/instructions/code/code_instructions.rb', line 15 def setup end |