Sha256: b107eb1b1170fe5e857087caa6b86be18d89601b7e8b24e3365495248188b2f3

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
mutant-0.5.23 lib/mutant/matcher.rb
mutant-0.5.22 lib/mutant/matcher.rb
mutant-0.5.21 lib/mutant/matcher.rb
mutant-0.5.20 lib/mutant/matcher.rb