Sha256: cf33b85707935bc7395bb22511d6d144548af5bdbfb17f9e376fb9b0034372c5
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module TableHelp class Config DEFAULT_OPTIONS = { table_for: { class: "table table-striped table-hover table_for", }, attributes_table_for: { class: "table table-striped table-hover attributes_table_for", }, }.freeze DEFAULT_FORMATTER = { attribute_name: ->(name, collection_or_resource) do case collection_or_resource when ActiveRecord::Relation collection_or_resource.model.human_attribute_name(name) else collection_or_resource.class.human_attribute_name(name) end end, value: ->(name, value) do case value when DateTime, Time I18n.l(value) when Numeric name.to_s.match?(/\Aid\z|_id\z/) ? value : value.to_s(:delimited) when TrueClass, FalseClass value.to_s else value end end, }.freeze attr_accessor :default_options, :formatter def initialize @default_options = DEFAULT_OPTIONS @formatter = DEFAULT_FORMATTER end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
table_help-0.1.5 | lib/table_help/config.rb |