Class: CSVDecision::Columns Private
- Inherits:
-
Object
- Object
- CSVDecision::Columns
- Defined in:
- lib/csv_decision/columns.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.
Dictionary of all this table’s columns - inputs, outputs etc.
Defined Under Namespace
Classes: Dictionary
Instance Method Summary collapse
- #dictionary ⇒ Object private
-
#ifs ⇒ Hash{Index=>Entry}
private
if: columns hash keyed by column index.
-
#initialize(table) ⇒ Columns
constructor
private
A new instance of Columns.
- #input_keys ⇒ Object private
-
#ins ⇒ Hash{Index=>Entry}
private
Input columns hash keyed by column index.
-
#outs ⇒ Hash{Index=>Entry}
private
Output columns hash keyed by column index.
Constructor Details
#initialize(table) ⇒ Columns
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 Columns.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/csv_decision/columns.rb', line 83 def initialize(table) # If a column does not have a valid header cell, then it's empty of data. # Return the stripped header row, and remove it from the data array. row = Header.strip_empty_columns(rows: table.rows) # Build a dictionary of all valid data columns from the header row. @dictionary = CSVDecision::Dictionary.build(header: row, dictionary: Dictionary.new) if row freeze end |
Instance Method Details
#dictionary ⇒ 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.
64 65 66 |
# File 'lib/csv_decision/columns.rb', line 64 def dictionary @dictionary.columns end |
#ifs ⇒ Hash{Index=>Entry}
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.
if: columns hash keyed by column index.
60 61 62 |
# File 'lib/csv_decision/columns.rb', line 60 def ifs @dictionary.ifs end |
#input_keys ⇒ 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.
68 69 70 |
# File 'lib/csv_decision/columns.rb', line 68 def input_keys @dictionary.columns.select { |_k, v| v == :in }.keys end |
#ins ⇒ Hash{Index=>Entry}
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.
Input columns hash keyed by column index.
48 49 50 |
# File 'lib/csv_decision/columns.rb', line 48 def ins @dictionary.ins end |
#outs ⇒ Hash{Index=>Entry}
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.
Output columns hash keyed by column index.
54 55 56 |
# File 'lib/csv_decision/columns.rb', line 54 def outs @dictionary&.outs end |