Class: CsvRowModel::Model::DynamicColumnHeader

Inherits:
Header
  • Object
show all
Includes:
DynamicColumnShared
Defined in:
lib/csv_row_model/internal/model/dynamic_column_header.rb

Instance Attribute Summary

Attributes inherited from Header

#column_name, #context, #row_model_class

Instance Method Summary collapse

Methods included from DynamicColumnShared

#column_index, #header_models, #header_models_context_key, #options

Methods included from ColumnShared

#context, #options

Methods inherited from Header

#formatted_header, #initialize, valid_options

Constructor Details

This class inherits a constructor from CsvRowModel::Model::Header

Instance Method Details

#format_header(header_model) ⇒ Object


17
18
19
# File 'lib/csv_row_model/internal/model/dynamic_column_header.rb', line 17

def format_header(header_model)
  row_model_class.format_dynamic_column_header(header_model, column_name, context)
end

#header_procObject


13
14
15
# File 'lib/csv_row_model/internal/model/dynamic_column_header.rb', line 13

def header_proc
  options[:header] || ->(header_model) { format_header(header_model) }
end

#valueObject


9
10
11
# File 'lib/csv_row_model/internal/model/dynamic_column_header.rb', line 9

def value
  header_models.map { |header_model| header_proc.call(header_model) }
end