Module: CSVDecision::Options Private
- Defined in:
- lib/csv_decision/options.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.
Validate and normalize the options values supplied.
Constant Summary
- DEFAULT_MATCHERS =
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.
Specialized cell value matchers beyond simple string compares. By default all these matchers are tried in the specified order on all input data cells.
[ Matchers::Range, Matchers::Numeric, Matchers::Pattern, Matchers::Constant, Matchers::Symbol, Matchers::Guard ].freeze
Class Method Summary collapse
-
.from_csv(rows:, options:) ⇒ Hash
private
Read any options supplied in the CSV file placed before the header row.
-
.normalize(options) ⇒ Hash
private
Validate options and supply default values for any options not explicitly set.
Class Method Details
.from_csv(rows:, options:) ⇒ 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.
Read any options supplied in the CSV file placed before the header row.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/csv_decision/options.rb', line 56 def self.from_csv(rows:, options:) row = rows.first return if row.nil? # Have we hit the header row? return if Header.row?(row) # Scan each cell looking for valid option values = scan_cells(row: row, options: ) rows.shift from_csv(rows: rows, options: ) end |
.normalize(options) ⇒ 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.
Validate options and supply default values for any options not explicitly set.
46 47 48 49 |
# File 'lib/csv_decision/options.rb', line 46 def self.normalize() validate() default() end |