Remove duplication in boolean mutator

This commit is contained in:
Markus Schirp 2012-08-03 01:38:35 +02:00
parent 41ed632100
commit a02756e0ca
2 changed files with 5 additions and 25 deletions

View file

@ -23,43 +23,23 @@ module Mutant
#
# @api private
#
abstract_method :inverse
def inverse
new(self.class::INVERSE_CLASS)
end
# Represent mutations of true literal
class TrueLiteral < Boolean
INVERSE_CLASS = Rubinius::AST::FalseLiteral
handle(Rubinius::AST::TrueLiteral)
private
# Return inverse
#
# @return [Rubinius::AST::FalseLiteral]
#
# @api private
#
def inverse
new(Rubinius::AST::FalseLiteral)
end
end
# Represent mutations of false literal
class FalseLiteral < Boolean
INVERSE_CLASS = Rubinius::AST::TrueLiteral
handle(Rubinius::AST::FalseLiteral)
private
# Return inverse class
#
# @return [Rubinius::AST::TrueLiteral]
#
# @api private
#
def inverse
new(Rubinius::AST::TrueLiteral)
end
end
end
end