free_mutant/lib/mutant/mutator/node/nthref.rb

30 lines
497 B
Ruby
Raw Normal View History

2013-08-02 19:36:13 -04:00
module Mutant
class Mutator
class Node
# Mutator for nth-ref nodes
class NthRef < self
handle :nth_ref
children :number
private
# Perform dispatch
#
# @return [undefined]
#
# @api private
#
def dispatch
2014-04-20 18:05:57 -04:00
unless number.equal?(1)
emit_number(number - 1)
end
2013-08-02 19:36:13 -04:00
emit_number(number + 1)
end
end # NthRef
end # Node
end # Mutator
end # Mutant