Class: WTT::Core::Matchers::Fuzzy

Inherits:
Object
  • Object
show all
Defined in:
lib/wtt/core/matchers/fuzzy_matcher.rb

Overview

Matches if the line that changed is within “spread” distance

Instance Method Summary collapse

Constructor Details

#initialize(spread = 11) ⇒ Fuzzy



11
12
13
# File 'lib/wtt/core/matchers/fuzzy_matcher.rb', line 11

def initialize(spread = 11)
  @spread = spread
end

Instance Method Details

#match(spectra, lineno) ⇒ Object



15
16
17
# File 'lib/wtt/core/matchers/fuzzy_matcher.rb', line 15

def match(spectra, lineno)
  true if spectra.any? { |v| (v - lineno).abs <= @spread } || lineno == 0
end