Sha256: eded4f9181e5610151e376cae6fc3b83add044cd230d3025cd159dd0b797bdad

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

# 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+

class CodeInstructionsInstruction < Instruction
  def preconditions?
    true
  end
  
  def setup
  end
  
  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
  
  def cleanup
    pushes :code, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/code/code_instructions.rb
nudge-0.2.8 lib/instructions/code/code_instructions.rb
nudge-0.2.7 lib/instructions/code/code_instructions.rb