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 |
# File 'lib/csv_decision/matchers/numeric.rb', line 29 def self.matches?(cell) return false unless (match = COMPARISON.match(cell)) return false unless (numeric_cell = Matchers.to_numeric(match['value'])) 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.
39 40 41 |
# File 'lib/csv_decision/matchers/numeric.rb', line 39 def matches?(cell) Numeric.matches?(cell) end |