free_mutant/lib/mutant/matcher/scope.rb
Dan Kubb 7293386c26 Add magic encoding header to all ruby files
* rubocop still warns about this on ruby 1.9.3, so it was fixed so
  it produces less output on travis.
2013-07-28 16:03:06 -07:00

36 lines
682 B
Ruby

# encoding: utf-8
module Mutant
class Matcher
# Matcher for specific namespace
class Scope < self
include Concord::Public.new(:cache, :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(cache, scope, &block)
end
self
end
end # Scope
end # Matcher
end # Mutant