Module: CsvRowModel::Import::DynamicColumns

Extended by:
ActiveSupport::Concern
Includes:
DynamicColumnsBase
Included in:
CsvRowModel::Import
Defined in:
lib/csv_row_model/concerns/import/dynamic_columns.rb

Constant Summary

Constants included from DynamicColumnsBase

DynamicColumnsBase::ATTRIBUTE_METHODS

Instance Method Summary collapse

Methods included from DynamicColumnsBase

#attribute_objects, #attributes

Instance Method Details

#dynamic_column_attribute_objectsObject


14
15
16
17
18
# File 'lib/csv_row_model/concerns/import/dynamic_columns.rb', line 14

def dynamic_column_attribute_objects
  @dynamic_column_attribute_objects ||= array_to_block_hash(self.class.dynamic_column_names) do |column_name|
    self.class.dynamic_attribute_class.new(column_name, dynamic_column_source_headers, dynamic_column_source_cells, self)
  end
end

#dynamic_column_source_cellsArray

Returns dynamic_column row data

Returns:

  • (Array)

    dynamic_column row data


31
32
33
# File 'lib/csv_row_model/concerns/import/dynamic_columns.rb', line 31

def dynamic_column_source_cells
  self.class.dynamic_column_source_cells source_row
end

#dynamic_column_source_headersArray

Returns dynamic_column headers

Returns:

  • (Array)

    dynamic_column headers


26
27
28
# File 'lib/csv_row_model/concerns/import/dynamic_columns.rb', line 26

def dynamic_column_source_headers
  self.class.dynamic_column_source_headers source_headers
end

#formatted_dynamic_column_headersArray

Returns an array of format_dynamic_column_header(...)

Returns:

  • (Array)

    an array of format_dynamic_column_header(...)


21
22
23
# File 'lib/csv_row_model/concerns/import/dynamic_columns.rb', line 21

def formatted_dynamic_column_headers
  dynamic_column_attribute_objects.values.first.try(:formatted_headers) || []
end