Sha256: 5c946aed8cee5acc6489ebd35310609f9ab5cd8647f21836e565731dcc6c9181

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

require 'csv_row_model/internal/model/header'
require 'csv_row_model/internal/concerns/dynamic_column_shared'

module CsvRowModel
  module Model
    class DynamicColumnHeader < Header
      include DynamicColumnShared

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_row_model-1.0.0.beta2 lib/csv_row_model/internal/model/dynamic_column_header.rb