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