Class: CSVDecision::Matchers::Proc Private
- Inherits:
-
Array
- Object
- Array
- CSVDecision::Matchers::Proc
- Defined in:
- lib/csv_decision/matchers.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.
Composite object for a data cell proc. Note that we do not need it to be comparable. Implemented as an immutable array of 2 or 3 entries for memory compactness and speed.
Instance Method Summary collapse
-
#function ⇒ Object
private
Either a lambda function, or some kind of constant such as an Integer.
-
#initialize(type:, function:, symbols: nil) ⇒ Proc
constructor
private
A new instance of Proc.
-
#symbols ⇒ nil, ...
private
The symbol or list of symbols that the function uses to reference input hash keys (which are always symbolized).
-
#type ⇒ Symbol
private
Type of the function value - e.g., :constant or :guard.
Constructor Details
#initialize(type:, function:, symbols: nil) ⇒ 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 a new instance of Proc
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/csv_decision/matchers.rb', line 20 def initialize(type:, function:, symbols: nil) super() self << type # Function values should always be frozen self << function.freeze # Some function values, such as constants or 0-arity functions, do not reference symbols. self << symbols if symbols freeze end |
Instance Method Details
#function ⇒ Object
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 Either a lambda function, or some kind of constant such as an Integer.
40 41 42 |
# File 'lib/csv_decision/matchers.rb', line 40 def function fetch(1) end |
#symbols ⇒ nil, ...
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 The symbol or list of symbols that the function uses to reference input hash keys (which are always symbolized).
46 47 48 |
# File 'lib/csv_decision/matchers.rb', line 46 def symbols fetch(2, nil) end |
#type ⇒ Symbol
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 Type of the function value - e.g., :constant or :guard.
35 36 37 |
# File 'lib/csv_decision/matchers.rb', line 35 def type fetch(0) end |