2013-04-20 21:16:48 +02:00
|
|
|
module Mutant
|
|
|
|
class Matcher
|
|
|
|
# Matcher for specific namespace
|
|
|
|
class Scope < self
|
2014-07-02 17:47:51 +00:00
|
|
|
include Concord::Public.new(:env, :scope, :expression)
|
2013-04-20 21:16:48 +02:00
|
|
|
|
|
|
|
MATCHERS = [
|
2013-06-14 20:54:02 +02:00
|
|
|
Matcher::Methods::Singleton,
|
2013-04-20 21:16:48 +02: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-30 13:06:57 +00:00
|
|
|
matcher.new(env, scope).each(&block)
|
2013-04-20 21:16:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2013-06-14 20:54:02 +02:00
|
|
|
end # Scope
|
|
|
|
end # Matcher
|
|
|
|
end # Mutant
|