Sha256: d07f630d392ca6a2f1b979066060febbc268173dc3677b4e72b54aa2022d6e05

Contents?: true

Size: 972 Bytes

Versions: 8

Compression:

Stored size: 972 Bytes

Contents

module Mutest
  class Matcher
    # Matcher expanding Mutest::Scope objects into method matches
    # at singleton or instance level
    #
    # If we *ever* get other subjects than methods, its likely the place
    # to hook in custom matchers. In that case the scope matchers to expand
    # should be passed as arguments to the constructor.
    class Scope < self
      include Concord.new(:scope)

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

      private_constant(*constants(false))

      # Matched subjects
      #
      # @param [Env::Bootstrap] env
      #
      # @return [Enumerable<Subject>]
      def call(env)
        Chain.new(effective_matchers).call(env)
      end

      private

      # Effective matchers
      #
      # @return [Enumerable<Matcher>]
      def effective_matchers
        MATCHERS.map { |matcher| matcher.new(scope) }
      end
    end # Scope
  end # Matcher
end # Mutest

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutest-0.0.9 lib/mutest/matcher/scope.rb
mutest-0.0.8 lib/mutest/matcher/scope.rb
mutest-0.0.7 lib/mutest/matcher/scope.rb
mutest-0.0.6 lib/mutest/matcher/scope.rb
mutest-0.0.5 lib/mutest/matcher/scope.rb
mutest-0.0.4 lib/mutest/matcher/scope.rb
mutest-0.0.3 lib/mutest/matcher/scope.rb
mutest-0.0.2 lib/mutest/matcher/scope.rb