Sha256: 3ed2da9e6b1cc667dc31c8dd2125eec89cb6d85cb2bab7702c9dec2b863b545f

Contents?: true

Size: 427 Bytes

Versions: 3

Compression:

Stored size: 427 Bytes

Contents

# pops the top item of the +:bool+ stack;
# pushes a ValuePoint with the value negated onto the +:bool+ stack
#
# *needs:* 1 +:bool+
#
# *pushes:* 1 +:bool+
#

class BoolNotInstruction < Instruction
  
  def preconditions?
    needs :bool, 1
  end
  
  def setup
    @arg1 = @context.pop_value(:bool)
  end
  
  def derive
    @result = ValuePoint.new("bool", !@arg1)
  end
  
  def cleanup
    pushes :bool, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/bool/bool_not.rb
nudge-0.2.8 lib/instructions/bool/bool_not.rb
nudge-0.2.7 lib/instructions/bool/bool_not.rb