eeb82ee8c6
* Some smells remain but it becomes cleaner now
46 lines
816 B
Ruby
46 lines
816 B
Ruby
module Mutant
|
|
# Abstract matcher to find subjects to mutate
|
|
class Matcher
|
|
include Adamantium::Flat, Enumerable, AbstractType
|
|
extend DescendantsTracker
|
|
|
|
# Enumerate subjects
|
|
#
|
|
# @param [Object] input
|
|
#
|
|
# @return [self]
|
|
# if block given
|
|
#
|
|
# @return [Enumerator<Subject>]
|
|
#
|
|
# @api private
|
|
#
|
|
def self.each(input, &block)
|
|
return to_enum(__method__, input) unless block_given?
|
|
|
|
new(input).each(&block)
|
|
|
|
self
|
|
end
|
|
|
|
# Enumerate subjects
|
|
#
|
|
# @api private
|
|
#
|
|
# @return [self]
|
|
# if block given
|
|
#
|
|
# @return [Enumerabe<Subject>]
|
|
# otherwise
|
|
#
|
|
abstract_method :each
|
|
|
|
# Return identification
|
|
#
|
|
# @return [String
|
|
#
|
|
# @api private
|
|
#
|
|
abstract_method :identification
|
|
end
|
|
end
|