Class: Evilution::Equivalent::Detector Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/equivalent/detector.rb

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

Instance Method Summary collapse

Constructor Details

#initialize(heuristics: nil) ⇒ Detector

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.

Returns a new instance of Detector.



14
15
16
# File 'lib/evilution/equivalent/detector.rb', line 14

def initialize(heuristics: nil)
  @heuristics = heuristics || default_heuristics
end

Instance Method Details

#call(mutations) ⇒ Object

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.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/evilution/equivalent/detector.rb', line 18

def call(mutations)
  equivalent = []
  remaining = []

  mutations.each do |mutation|
    if @heuristics.any? { |h| h.match?(mutation) }
      equivalent << mutation
    else
      remaining << mutation
    end
  end

  [equivalent, remaining]
end