Sha256: 125e5fdd9f33a8b39a21fecee462b878e1abbecf5a224b5a5f8d8ed1c6a65375

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

module Mutant
  class Mutation
    class Filter
      # Mutation filter that filters on mutation codes
      class Code < self
        include Concord::Public.new(:code)

        # Test for match
        #
        # @param [Mutation] mutation
        #
        # @return [true]
        #   returns true if mutation code matches filter code
        #
        # @return [false]
        #   returns false otherwise
        #
        # @api private
        #
        def match?(mutation)
          mutation.code.eql?(code)
        end

        PATTERN = /\Acode:([a-f0-9]{1,6})\z/.freeze

        # Test if class handles string
        #
        # @param [String] notation
        #
        # @return [Filter]
        #   return code filter instance if notation matches pattern
        #
        # @return [nil]
        #   returns nil otherwise
        #
        # @api private
        #
        def self.handle(notation)
          match = PATTERN.match(notation)
          return unless match
          new(match[1])
        end

      end # Code
    end # Filter
  end # Mutation
end # Mutant

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.3.0.rc1 lib/mutant/mutation/filter/code.rb
mutant-0.3.0.beta22 lib/mutant/mutation/filter/code.rb