Sha256: d129af0200c70a4b5c97da2deb1e642f2a434700d630d7ac1d9fed4137114978
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require "csvbuilder/core/internal/concerns/column_shared" module Csvbuilder module DynamicColumnShared include ColumnShared extend ActiveSupport::Concern # # row_model_class # def column_index @column_index ||= row_model_class.dynamic_column_index(column_name) end def options row_model_class.dynamic_columns[column_name] end # # header models # # return the collection given by the context # i.e: skills: ["Ruby", "Python", "Javascript"] # header_models => ["Ruby", "Python", "Javascript"] # # @return [Array] Array of values def header_models Array(context.public_send(header_models_context_key)) end # The name of the dynamic_column # # i.e: With dynamic_column :skills # => :skills # # i.e: With dynamic_column :skills, as: :programming_languages # => :programming_languages # # @return [Symbol] Symbol def header_models_context_key options[:as] || column_name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csvbuilder-dynamic-columns-core-0.1.1 | lib/csvbuilder/dynamic/columns/core/internal/concerns/dynamic_column_shared.rb |