Class: CSVDecision::Matchers::Function Private

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

* no arguments - e.g., := present?
* with arguments - e.g., :=lookup?(:table)

TODO: fully implement

Constant Summary collapse

FUNCTION_RE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Function call regular expression.

Matchers.regexp(FUNCTION_CALL)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

#ins?, #outs?

Constructor Details

#initialize(options = {}) ⇒ Function

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 a new instance of Function.

Parameters:

  • options (Hash{Symbol=>Object}) (defaults to: {})

    Options hash controlling how the table is parsed and interpreted.



40
41
42
# File 'lib/csv_decision/matchers/function.rb', line 40

def initialize(options = {})
  @options = options
end

Class 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.

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
37
# File 'lib/csv_decision/matchers/function.rb', line 29

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

  # operator = match['operator']&.gsub(/\s+/, '')
  # name = match['name'].to_sym
  # args = match['args'].strip
  # negate = match['negate'] == Matchers::NEGATE
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.



46
47
48
# File 'lib/csv_decision/matchers/function.rb', line 46

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