lib/mutant/mutator.rb in mutant-0.5.19 vs lib/mutant/mutator.rb in mutant-0.5.20
- old
+ new
@@ -1,16 +1,17 @@
-# encoding: utf-8
-
module Mutant
# Generator for mutations
class Mutator
include Adamantium::Flat, AbstractType
# Run mutator on input
#
- # @param [Parser::AST::Node] node
+ # @param [Object] input
+ # the input to mutate
#
+ # @param [Mutator] parent
+ #
# @return [self]
#
# @api private
#
def self.each(input, parent = nil, &block)
@@ -115,37 +116,9 @@
return unless new?(object)
guard(object)
emit!(object)
- end
-
- # Maximum amount of tries to generate a new object
- MAX_TRIES = 3
-
- # Call block until it generates a mutation
- #
- # @yield
- # Execute block until object is generated where new?(object) returns true
- #
- # @return [self]
- #
- # @raise [RuntimeError]
- # raises RuntimeError when no new node can be generated after MAX_TRIES.
- #
- # @api private
- #
- def emit_new
- MAX_TRIES.times do
- object = yield
-
- if new?(object)
- emit!(object)
- return
- end
- end
-
- raise "New AST could not be generated after #{MAX_TRIES} attempts"
end
# Call block with node
#
# @param [Parser::AST::Node] node