Sha256: 9eb4ed055401f52807dd825e9ca57318b4c5fdd0d7013afc87490432301c2678
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
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 if collection_or_resource.respond_to?(:model) 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?(/_*id\z/) ? value : value.to_s(:delimited) 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.2 | lib/table_help/config.rb |