Class: CSVDecision::Matchers::Constant Private

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

Cell constant matcher - e.g., := true, = nil.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

#initialize, #ins?

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.



31
32
33
34
35
36
37
38
# File 'lib/csv_decision/matchers/constant.rb', line 31

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

  proc = non_numeric?(match)
  return proc if proc

  numeric?(match)
end

Instance Method Details

#matches?(cell) ⇒ Boolean

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.

If a constant expression returns a Proc of type :constant,

otherwise return false.

(see Matcher#matches?)

Returns:

  • (Boolean)


65
66
67
# File 'lib/csv_decision/matchers/constant.rb', line 65

def matches?(cell)
  Matchers::Constant.matches?(cell)
end

#outs?Boolean

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.

Does this matcher apply to output cells?

Returns:

  • (Boolean)

    Return true if this matcher applies to output cells, false otherwise.



70
71
72
# File 'lib/csv_decision/matchers/constant.rb', line 70

def outs?
  true
end