Class: Mutant::Mutation::Filter::Code

Inherits:
Mutant::Mutation::Filter show all
Defined in:
lib/mutant/mutation/filter/code.rb

Overview

Mutation filter that filters on mutation codes

Constant Summary collapse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mutant::Mutation::Filter

build

Instance Attribute Details

#codeString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return code

Returns:

  • (String)


50
51
52
# File 'lib/mutant/mutation/filter/code.rb', line 50

def code
  @code
end

Class Method Details

.handle(notation) ⇒ Filter?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if class handles string

Parameters:

  • notation (String)

Returns:

  • (Filter)

    return code filter instance if notation matches pattern

  • (nil)

    returns nil otherwise



38
39
40
41
42
# File 'lib/mutant/mutation/filter/code.rb', line 38

def self.handle(notation)
  match = PATTERN.match(notation) 
  return unless match
  new(match[1])
end

Instance Method Details

#match?(mutation) ⇒ true, false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test for match

Parameters:

Returns:

  • (true)

    returns true if mutation code matches filter code

  • (false)

    returns false otherwise



20
21
22
# File 'lib/mutant/mutation/filter/code.rb', line 20

def match?(mutation)
  mutation.code.eql?(code)
end