Module: Csvbuilder::DynamicColumnShared
- Extended by:
- ActiveSupport::Concern
- Includes:
- ColumnShared
- Included in:
- DynamicColumnAttributeBase, Model::DynamicColumnHeader
- Defined in:
- lib/csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared.rb
Instance Method Summary collapse
-
#column_index ⇒ Object
row_model_class.
-
#header_models ⇒ Array
header models.
-
#header_models_context_key ⇒ Symbol
The name of the dynamic_column.
- #options ⇒ Object
Instance Method Details
#column_index ⇒ Object
row_model_class
13 14 15 |
# File 'lib/csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared.rb', line 13 def column_index @column_index ||= row_model_class.dynamic_column_index(column_name) end |
#header_models ⇒ Array
header models
return the collection given by the context i.e: skills: [“Ruby”, “Python”, “Javascript”] header_models => [“Ruby”, “Python”, “Javascript”]
29 30 31 |
# File 'lib/csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared.rb', line 29 def header_models Array(context.public_send(header_models_context_key)) end |
#header_models_context_key ⇒ Symbol
The name of the dynamic_column
i.e: With dynamic_column :skills
> :skills
i.e: With dynamic_column :skills, as: :programming_languages
> :programming_languages
42 43 44 |
# File 'lib/csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared.rb', line 42 def header_models_context_key [:as] || column_name end |
#options ⇒ Object
17 18 19 |
# File 'lib/csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared.rb', line 17 def row_model_class.dynamic_columns[column_name] end |