Sha256: 347f4983c4ed169fa5b7d49cdad2b4af03a51362f24d8cfdecd1238c8c48cfbe

Contents?: true

Size: 494 Bytes

Versions: 3

Compression:

Stored size: 494 Bytes

Contents

# pops the top 2 items of the +:name+ stack;
# pushes a new ValuePoint onto the +:bool+ stack, with value +true+ if the names are identical
#
# *needs:* 2 +:name+
#
# *pushes:* 1 +:bool+
#

class NameEqualQInstruction < Instruction
  def preconditions?
    needs :name, 2
  end
  def setup
    @arg2 = @context.pop_value(:name)
    @arg1 = @context.pop_value(:name)
  end
  def derive
    @result = ValuePoint.new("bool", @arg1 == @arg2)
  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/name/name_equal_q.rb
nudge-0.2.8 lib/instructions/name/name_equal_q.rb
nudge-0.2.7 lib/instructions/name/name_equal_q.rb