Sha256: 30ab4d63a88dd92051b019e3884e187620d7882224a8ba6e90357fb22799d39a

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

module CsvRowModel
  module Export
    class DynamicColumnCell < CsvRowModel::Model::DynamicColumnCell
      def unformatted_value
        formatted_cells
      end

      def formatted_cells
        cells.map.with_index.map do |cell, index|
          row_model.class.format_cell(cell, column_name, dynamic_column_index + index, row_model.context)
        end
      end

      def cells
        header_models.map { |header_model| call_process_cell(header_model) }
      end

      def header_models
        row_model.context.public_send(column_name)
      end

      class << self
        def define_process_cell(row_model_class, column_name)
          super { |header_model| header_model }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_row_model-1.0.0.beta1 lib/csv_row_model/export/dynamic_column_cell.rb