2013-04-20 15:16:48 -04:00
|
|
|
module Mutant
|
|
|
|
class Matcher
|
|
|
|
# Matcher for specific namespace
|
|
|
|
class Scope < self
|
2013-05-21 20:40:33 -04:00
|
|
|
include Concord::Public.new(:scope)
|
2013-04-20 15:16:48 -04:00
|
|
|
|
|
|
|
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
|