free_mutant/lib/mutant/matcher/scope.rb

35 lines
614 B
Ruby
Raw Normal View History

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