Class: ActiveAdmin::Xls::Builder::Column
- Inherits:
-
Object
- Object
- ActiveAdmin::Xls::Builder::Column
- Defined in:
- lib/active_admin/xls/builder.rb
Overview
Xls column information
Instance Attribute Summary collapse
-
#data ⇒ String, ...
readonly
The column name used to look up the value, or a block used to generate the value to display.
-
#name ⇒ String, Symbol
readonly
Column name.
Instance Method Summary collapse
-
#initialize(name, block = nil) ⇒ Column
constructor
A new instance of Column.
-
#localized_name(i18n_scope = nil) ⇒ Object
Returns a localized version of the column name if a scope is given.
Constructor Details
#initialize(name, block = nil) ⇒ Column
Returns a new instance of Column.
283 284 285 286 |
# File 'lib/active_admin/xls/builder.rb', line 283 def initialize(name, block = nil) @name = name @data = block || @name end |
Instance Attribute Details
#data ⇒ String, ... (readonly)
Returns The column name used to look up the value, or a block used to generate the value to display.
293 294 295 |
# File 'lib/active_admin/xls/builder.rb', line 293 def data @data end |
#name ⇒ String, Symbol (readonly)
Returns Column name.
289 290 291 |
# File 'lib/active_admin/xls/builder.rb', line 289 def name @name end |
Instance Method Details
#localized_name(i18n_scope = nil) ⇒ Object
Returns a localized version of the column name if a scope is given. Otherwise, it returns the titleized column name without translation.
302 303 304 305 |
# File 'lib/active_admin/xls/builder.rb', line 302 def localized_name(i18n_scope = nil) return name.to_s.titleize unless i18n_scope I18n.t name, scope: i18n_scope end |