Sha256: 88abd61c6de4dde6455a00fabf96a4f2e4db824241be0c476eb60006b6634d16
Contents?: true
Size: 424 Bytes
Versions: 3
Compression:
Stored size: 424 Bytes
Contents
# pops the top +:bool+ item; # pushes a new +:int+ item, # with value 0 when the +:bool+ is +false+, otherwise 1 # # *needs:* 1 +:bool+ # # *pushes:* 1 +:int+ # class IntFromBoolInstruction < Instruction def preconditions? needs :bool, 1 end def setup @arg = @context.pop_value(:bool) end def derive @result = ValuePoint.new("int", @arg ? 1 : 0) end def cleanup pushes :int, @result end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nudge-0.2.9 | lib/instructions/conversion/int_from_bool.rb |
nudge-0.2.8 | lib/instructions/conversion/int_from_bool.rb |
nudge-0.2.7 | lib/instructions/conversion/int_from_bool.rb |