Module: CSVDecision::Decide Private
- Defined in:
- lib/csv_decision/decide.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Main module for searching the decision table looking for one or more matches
Class Method Summary collapse
-
.decide(table:, input:, symbolize_keys:) ⇒ Hash
private
Main method for making decisions.
-
.matches?(row:, input:, scan_row:) ⇒ Boolean
private
Match the table row against the input hash.
Class Method Details
.decide(table:, input:, symbolize_keys:) ⇒ Hash
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.
Main method for making decisions.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/csv_decision/decide.rb', line 33 def self.decide(table:, input:, symbolize_keys:) # Parse and transform the hash supplied as input parsed_input = Input.parse(table: table, input: input, symbolize_keys: symbolize_keys) # The decision object collects the results of the search and # calculates the final result decision = Decision.new(table: table, input: parsed_input) # table_scan(table: table, input: parsed_input, decision: decision) decision.scan(table: table, input: parsed_input) end |
.matches?(row:, input:, scan_row:) ⇒ 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.
Match the table row against the input hash.
17 18 19 20 21 22 23 24 |
# File 'lib/csv_decision/decide.rb', line 17 def self.matches?(row:, input:, scan_row:) match = scan_row.match_constants?(row: row, scan_cols: input[:scan_cols]) return false unless match return true if scan_row.procs.empty? scan_row.match_procs?(row: row, input: input) end |