2012-07-23 22:54:35 +02:00
|
|
|
module Mutant
|
2013-01-21 20:08:30 +01:00
|
|
|
# Abstract matcher to find subjects to mutate
|
2012-07-23 22:54:35 +02:00
|
|
|
class Matcher
|
2012-11-26 11:30:00 +01:00
|
|
|
include Adamantium::Flat, Enumerable, AbstractType
|
2012-08-28 19:54:28 +02:00
|
|
|
extend DescendantsTracker
|
2012-07-23 22:54:35 +02:00
|
|
|
|
2013-01-21 22:56:52 +01:00
|
|
|
# Enumerate subjects
|
|
|
|
#
|
|
|
|
# @param [Object] input
|
|
|
|
#
|
|
|
|
# @return [self]
|
|
|
|
# if block given
|
|
|
|
#
|
|
|
|
# @return [Enumerator<Subject>]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-06-27 22:18:07 +02:00
|
|
|
def self.each(cache, input, &block)
|
|
|
|
return to_enum(__method__, cache, input) unless block_given?
|
2013-01-21 22:56:52 +01:00
|
|
|
|
2013-06-27 22:18:07 +02:00
|
|
|
new(cache, input).each(&block)
|
2013-01-21 22:56:52 +01:00
|
|
|
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2012-08-01 18:34:03 +02:00
|
|
|
# Enumerate subjects
|
2012-07-23 22:54:35 +02:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-01-21 20:08:30 +01:00
|
|
|
# @return [self]
|
|
|
|
# if block given
|
|
|
|
#
|
|
|
|
# @return [Enumerabe<Subject>]
|
|
|
|
# otherwise
|
2012-07-24 01:41:08 +02:00
|
|
|
#
|
2012-08-03 01:28:15 +02:00
|
|
|
abstract_method :each
|
2012-07-26 19:25:23 +02:00
|
|
|
|
2012-08-16 04:10:54 +02:00
|
|
|
# Return identification
|
|
|
|
#
|
|
|
|
# @return [String
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
abstract_method :identification
|
2013-06-14 20:54:02 +02:00
|
|
|
|
|
|
|
end # Matcher
|
|
|
|
end # Mutant
|