free_mutant/lib/mutant/matcher/chain.rb

30 lines
520 B
Ruby
Raw Normal View History

2012-08-29 08:00:37 -04:00
module Mutant
class Matcher
# A chain of matchers
class Chain < self
include Concord.new(:matchers)
2012-08-29 08:00:37 -04:00
# Enumerate subjects
#
# @return [Enumerator<Subject]
# if no block given
2012-08-29 08:00:37 -04:00
#
# @return [self]
# otherwise
2012-08-29 08:00:37 -04:00
#
# @api private
#
def each(&block)
return to_enum unless block_given?
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