Sha256: 7b2cc395969a82e3b8c12a46642f1dd43f24240ffb818395f90cdacfa524a400

Contents?: true

Size: 861 Bytes

Versions: 19

Compression:

Stored size: 861 Bytes

Contents

module Mutant
  class Matcher
    # Matcher for specific namespace
    class Scope < self
      include Concord::Public.new(:env, :scope, :expression)

      MATCHERS = [
        Matcher::Methods::Singleton,
        Matcher::Methods::Instance
      ].freeze

      # Return identification
      #
      # @return [String]
      #
      # @api private
      #
      def identification
        scope.name
      end
      memoize :identification

      # 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.new(env, scope).each(&block)
        end

        self
      end

    end # Scope
  end # Matcher
end # Mutant

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mutant-0.8.0 lib/mutant/matcher/scope.rb
mutant-0.7.9 lib/mutant/matcher/scope.rb
mutant-0.7.8 lib/mutant/matcher/scope.rb
mutant-0.7.7 lib/mutant/matcher/scope.rb
mutant-0.7.6 lib/mutant/matcher/scope.rb
mutant-0.7.5 lib/mutant/matcher/scope.rb
mutant-0.7.4 lib/mutant/matcher/scope.rb
mutant-0.7.3 lib/mutant/matcher/scope.rb
mutant-0.7.2 lib/mutant/matcher/scope.rb
mutant-0.7.1 lib/mutant/matcher/scope.rb
mutant-0.6.7 lib/mutant/matcher/scope.rb
mutant-0.6.6 lib/mutant/matcher/scope.rb
mutant-0.6.5 lib/mutant/matcher/scope.rb
mutant-0.6.4 lib/mutant/matcher/scope.rb
mutant-0.6.3 lib/mutant/matcher/scope.rb
mutant-0.6.2 lib/mutant/matcher/scope.rb
mutant-0.6.0 lib/mutant/matcher/scope.rb
mutant-0.5.26 lib/mutant/matcher/scope.rb
mutant-0.5.25 lib/mutant/matcher/scope.rb