
* I do not use 1.9.3 * Also keeping them in each file increases mental overhead (true it *can* be autoamted) * None of the files encodes NON ASCII chars. * I do not expect it makes any difference, since nobody programmatically will consume strings generated by mutant under the assumption they are UTF-8 encoded. * 1.9.3 Users have to deal with the encoding fuckup under ruby anyways.
47 lines
867 B
Ruby
47 lines
867 B
Ruby
module Mutant
|
|
class Mutator
|
|
# Namespace for utility mutators
|
|
class Util < self
|
|
|
|
# Run ulitity mutator
|
|
#
|
|
# @param [Object] object
|
|
# @param [Object] parent
|
|
#
|
|
# @return [Enumerator<Object>]
|
|
# if no block given
|
|
#
|
|
# @return [self]
|
|
# otherwise
|
|
#
|
|
# @api private
|
|
#
|
|
def self.each(object, parent, &block)
|
|
return to_enum(__method__, object, parent) unless block_given?
|
|
|
|
new(object, parent, block)
|
|
|
|
self
|
|
end
|
|
|
|
private
|
|
|
|
# Test if mutation is new
|
|
#
|
|
# @param [Object] generated
|
|
#
|
|
# @return [true]
|
|
# if object is new
|
|
#
|
|
# @return [false]
|
|
# otherwise
|
|
#
|
|
# @api private
|
|
#
|
|
def new?(generated)
|
|
input != generated
|
|
end
|
|
|
|
end # Util
|
|
end # Mutator
|
|
end # Mutant
|