Sha256: 6062c2189efb6b02a838ea151efa1b09dde72d522b7a1426542eb7aafd10b623

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8

module Mutant
  # Abstract matcher to find subjects to mutate
  class Matcher
    include Adamantium::Flat, Enumerable, AbstractType

    # Enumerate subjects
    #
    # @param [Object] input
    #
    # @return [self]
    #   if block given
    #
    # @return [Enumerable<Subject>]
    #   otherwise
    #
    # @api private
    #
    def self.each(cache, input, &block)
      return to_enum(__method__, cache, input) unless block_given?

      build(cache, input).each(&block)

      self
    end

    # Default matcher build implementation
    #
    # @param [Cache] cache
    # @param [Object] input
    #
    # @return [undefined]
    #
    # @api private
    #
    def self.build(*arguments)
      new(*arguments)
    end

    # Enumerate subjects
    #
    # @api private
    #
    # @return [self]
    #   if block given
    #
    # @return [Enumerabe<Subject>]
    #   otherwise
    #
    abstract_method :each

    # Return identification
    #
    # @return [String
    #
    # @api private
    #
    abstract_method :identification

  end # Matcher
end # Mutant

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mutant-0.5.19 lib/mutant/matcher.rb
mutant-0.5.18 lib/mutant/matcher.rb
mutant-0.5.17 lib/mutant/matcher.rb
mutant-0.5.16 lib/mutant/matcher.rb
mutant-0.5.15 lib/mutant/matcher.rb
mutant-0.5.14 lib/mutant/matcher.rb
mutant-0.5.13 lib/mutant/matcher.rb
mutant-0.5.12 lib/mutant/matcher.rb
mutant-0.5.11 lib/mutant/matcher.rb
mutant-0.5.10 lib/mutant/matcher.rb