lib/csv_row_model/internal/model/header.rb
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, context)
end
class << self
def valid_options
%i[header]
end
end
end
end
end