2013-04-20 15:16:48 -04:00
|
|
|
module Mutant
|
|
|
|
class Matcher
|
|
|
|
# Matcher for specific namespace
|
|
|
|
class Scope < self
|
2013-06-27 16:18:07 -04:00
|
|
|
include Concord::Public.new(:cache, :scope)
|
2013-04-20 15:16:48 -04:00
|
|
|
|
|
|
|
MATCHERS = [
|
2013-06-14 14:54:02 -04:00
|
|
|
Matcher::Methods::Singleton,
|
2013-04-20 15:16:48 -04:00
|
|
|
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|
|
2014-06-28 20:10:11 -04:00
|
|
|
matcher.new(cache, scope).each(&block)
|
2013-04-20 15:16:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2013-06-14 14:54:02 -04:00
|
|
|
end # Scope
|
|
|
|
end # Matcher
|
|
|
|
end # Mutant
|