Class: WTT::Core::Matchers::Fuzzy
- Inherits:
-
Object
- Object
- WTT::Core::Matchers::Fuzzy
- Defined in:
- lib/wtt/core/matchers/fuzzy_matcher.rb
Overview
Matches if the line that changed is within “spread” distance
Instance Method Summary collapse
-
#initialize(spread = 11) ⇒ Fuzzy
constructor
A new instance of Fuzzy.
- #match(spectra, lineno) ⇒ Object
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 |