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
Returns false if this cell is not a match; otherwise returns the
CSVDecision::Procobject indicating if this is a constant or some type of function.
Instance Method Summary collapse
-
#matches?(cell) ⇒ false, CSVDecision::Proc
private
Returns false if this cell is not a match; otherwise returns the
CSVDecision::Procobject indicating if this is a constant or some type of function.
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.
Returns false if this cell is not a match; otherwise returns the CSVDecision::Proc object indicating if this is a constant or some type of function.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/csv_decision/matchers/numeric.rb', line 30 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.
Returns false if this cell is not a match; otherwise returns the CSVDecision::Proc object indicating if this is a constant or some type of function.
44 45 46 |
# File 'lib/csv_decision/matchers/numeric.rb', line 44 def matches?(cell) Numeric.matches?(cell) end |