Class: CSVDecision::Matchers::Function Private
- 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
- .matches?(cell) ⇒ Boolean private
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Function
constructor
private
A new instance of Function.
-
#matches?(cell) ⇒ false, CSVDecision::Proc
private
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.
Methods inherited from Matcher
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.
40 41 42 |
# File 'lib/csv_decision/matchers/function.rb', line 40 def initialize( = {}) @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.
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.
46 47 48 |
# File 'lib/csv_decision/matchers/function.rb', line 46 def matches?(cell) Function.matches?(cell) end |