Module: CSVDecision::Constant

Defined in:
lib/csv_decision/constant.rb

Overview

Recognise constant expressions in table data cells - e.g., = nil, :=true.

Class Method Summary collapse

Class Method Details

.matches?(cell) ⇒ Boolean, ...

Parameters:

  • cell (String)

    Data row cell.

Returns:

  • (Boolean)
  • (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.



27
28
29
30
31
32
33
34
# File 'lib/csv_decision/constant.rb', line 27

def self.matches?(cell)
  return false unless (match = EXPRESSION.match(cell))

  proc = non_numeric?(match)
  return proc if proc

  numeric?(match)
end