Sha256: 4fa51a440ece7610cddc77869ea0f2947a615256fbd4356bd14521bd406cc544

Contents?: true

Size: 464 Bytes

Versions: 3

Compression:

Stored size: 464 Bytes

Contents

# encoding: utf-8
# 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+
#

class CodeFromBoolInstruction < Instruction
  def preconditions?
    needs :bool, 1
  end
  def setup
    @arg = @context.pop_value(:bool)
  end
  def derive
    @result = ValuePoint.new("code", "value «bool»\n«bool» #{@arg}")
  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/conversion/code_from_bool.rb
nudge-0.2.8 lib/instructions/conversion/code_from_bool.rb
nudge-0.2.7 lib/instructions/conversion/code_from_bool.rb