Sha256: 98be5ba093d7cb5e68f7c00f5ec9ef62f754bb6ce1d1e9cf755de58677d9c3cc
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
# frozen_string_literal: true require "csvbuilder/core/internal/concerns/column_shared" module Csvbuilder 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 case options[:header] when Proc return options[:header].call(column_name, context) when String return options[:header] end formatted_header(column_name.to_s.humanize) end def formatted_header(header_name) row_model_class.format_header(header_name, context) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csvbuilder-core-0.1.3 | lib/csvbuilder/core/internal/model/header.rb |