free_mutant/lib/mutant/matcher/scope.rb
Markus Schirp 3965ca4eae Add scope classifier and matcher
This simplifies the namespace matcher a lot, it can use the scope
matcher internally.
2013-04-20 21:16:48 +02:00

34 lines
614 B
Ruby

module Mutant
class Matcher
# Matcher for specific namespace
class Scope < self
include Concord.new(:scope)
MATCHERS = [
Matcher::Methods::Singleton,
Matcher::Methods::Instance
].freeze
# Enumerate subjects
#
# @return [self]
# if block given
#
# @return [Enumerator<Subject>]
# otherwise
#
# @api private
#
def each(&block)
return to_enum unless block_given?
MATCHERS.each do |matcher|
matcher.each(scope, &block)
end
self
end
end
end
end