Sha256: 4c22c329fa9a22c44ed3351b038f20a54ab921af782010f12ad31bda32e9788f

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

require 'csv_row_model/internal/concerns/column_shared'

module CsvRowModel
  module Model
    class Header
      include ColumnShared

      attr_reader :column_name, :row_model_class, :context

      def initialize(column_name, row_model_class, context)
        @column_name = column_name
        @row_model_class = row_model_class
        @context = OpenStruct.new(context)
      end

      def value
        options[:header] || formatted_header
      end

      def formatted_header
        row_model_class.format_header(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/header.rb