Class: CSVDecision::Matchers::Numeric Private
- Defined in:
- lib/csv_decision/matchers/numeric.rb
Overview
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.
Recognise numeric comparison expressions - e.g., > 100 or != 0.
Class Method Summary collapse
-
.matches?(cell) ⇒ false, CSVDecision::Proc
private
Determine if the input cell string is recognised by this Matcher.
Instance Method Summary collapse
-
#matches?(cell) ⇒ false, CSVDecision::Proc
private
Determine if the input cell string is recognised by this Matcher.
Methods inherited from Matcher
Constructor Details
This class inherits a constructor from CSVDecision::Matchers::Matcher
Class Method Details
.matches?(cell) ⇒ false, CSVDecision::Proc
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.
Determine if the input cell string is recognised by this Matcher.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/csv_decision/matchers/numeric.rb', line 29 def self.matches?(cell) match = COMPARISON.match(cell) return false unless match numeric_cell = Matchers.to_numeric(match['value']) return false unless numeric_cell comparator = match['comparator'] Matchers::Proc.new(type: :proc, function: COMPARATORS[comparator].curry[numeric_cell].freeze) end |
Instance Method Details
#matches?(cell) ⇒ false, CSVDecision::Proc
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.
Determine if the input cell string is recognised by this Matcher.
42 43 44 |
# File 'lib/csv_decision/matchers/numeric.rb', line 42 def matches?(cell) Numeric.matches?(cell) end |