Class: CSVDecision::Matchers::Range
- Defined in:
- lib/csv_decision/matchers/range.rb
Overview
Match cell against a Ruby-like range
Class Method Summary collapse
-
.matches?(cell) ⇒ false, CSVDecision::Proc
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
Range expression - e.g.,
0...10ora..z.
Methods inherited from Matcher
Constructor Details
This class inherits a constructor from CSVDecision::Matchers::Matcher
Class Method Details
.matches?(cell) ⇒ false, CSVDecision::Proc
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.
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/csv_decision/matchers/range.rb', line 69 def self.matches?(cell) if (match = NUMERIC_RANGE.match(cell)) return range_proc(match: match, coerce: :to_numeric) end if (match = ALNUM_RANGE.match(cell)) return range_proc(match: match) end false end |
Instance Method Details
#matches?(cell) ⇒ false, CSVDecision::Proc
Range expression - e.g., 0...10 or a..z
84 85 86 |
# File 'lib/csv_decision/matchers/range.rb', line 84 def matches?(cell) Range.matches?(cell) end |