2012-08-29 08:00:37 -04:00
|
|
|
module Mutant
|
|
|
|
class Matcher
|
|
|
|
# A chain of matchers
|
|
|
|
class Chain < self
|
2014-07-06 10:32:36 -04:00
|
|
|
include Concord.new(:matchers)
|
2012-08-29 08:00:37 -04:00
|
|
|
|
|
|
|
# Enumerate subjects
|
|
|
|
#
|
|
|
|
# @return [Enumerator<Subject]
|
2013-09-11 14:48:44 -04:00
|
|
|
# if no block given
|
2012-08-29 08:00:37 -04:00
|
|
|
#
|
|
|
|
# @return [self]
|
2013-09-11 14:48:44 -04:00
|
|
|
# otherwise
|
2012-08-29 08:00:37 -04:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def each(&block)
|
|
|
|
return to_enum unless block_given?
|
|
|
|
|
2012-10-26 05:24:29 -04:00
|
|
|
matchers.each do |matcher|
|
2012-08-29 08:00:37 -04:00
|
|
|
matcher.each(&block)
|
|
|
|
end
|
|
|
|
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2013-06-14 14:54:02 -04:00
|
|
|
end # Chain
|
|
|
|
end # Matcher
|
|
|
|
end # Mutant
|