Class: CSVDecision::Matchers::Symbol Private

Inherits:
Matcher
  • Object
show all
Defined in:
lib/csv_decision/matchers/symbol.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.

Match cell against a symbolic expression - e.g., :column, > :column

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

#initialize, #ins?, #outs?

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.

Parameters:

  • cell (String)

    Data row cell.

Returns:

  • (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
# File 'lib/csv_decision/matchers/symbol.rb', line 69

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

  comparator = match['comparator'] || '='
  name = match['name'].to_sym

  comparison(comparator: comparator, name: name)
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.

Parameters:

  • cell (String)

    Data row cell.

Returns:

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



81
82
83
# File 'lib/csv_decision/matchers/symbol.rb', line 81

def matches?(cell)
  Symbol.matches?(cell)
end