Module: CSVDecision::Dictionary Private
- Defined in:
- lib/csv_decision/dictionary.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.
Parse the CSV file’s header row. These methods are only required at table load time.
Defined Under Namespace
Classes: Entry
Class Method Summary collapse
-
.add_name(columns:, name:, out: false) ⇒ Hash{Symbol=>[:in, Integer]}
private
Add a new symbol to the dictionary of named input and output columns.
-
.build(header:, dictionary:) ⇒ Hash<Hash>
private
Classify and build a dictionary of all input and output columns by parsing the header row.
Class Method Details
.add_name(columns:, name:, out: false) ⇒ Hash{Symbol=>[:in, Integer]}
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.
Add a new symbol to the dictionary of named input and output columns.
111 112 113 114 115 116 |
# File 'lib/csv_decision/dictionary.rb', line 111 def self.add_name(columns:, name:, out: false) Validate.name(columns: columns, name: name, out: out) columns[name] = out ? out : :in columns end |
.build(header:, dictionary:) ⇒ Hash<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.
Classify and build a dictionary of all input and output columns by parsing the header row.
97 98 99 100 101 102 103 |
# File 'lib/csv_decision/dictionary.rb', line 97 def self.build(header:, dictionary:) header.each_with_index do |cell, index| dictionary = parse_cell(cell: cell, index: index, dictionary: dictionary) end dictionary end |