Sha256: d574df7384034d0ac193e9f5810d68852a6dd37249148c7ba8ead0785ca1276e

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 Bytes

Contents

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

      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

1 entries across 1 versions & 1 rubygems

Version Path
mutant-0.5.24 lib/mutant/matcher/scope.rb