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.
281 282 283 284 |
# File 'lib/active_admin/xls/builder.rb', line 281 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.
291 292 293 |
# File 'lib/active_admin/xls/builder.rb', line 291 def data @data end |
#name ⇒ String, Symbol (readonly)
Returns Column name.
287 288 289 |
# File 'lib/active_admin/xls/builder.rb', line 287 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.
300 301 302 303 |
# File 'lib/active_admin/xls/builder.rb', line 300 def localized_name(i18n_scope = nil) return name.to_s.titleize unless i18n_scope I18n.t name, scope: i18n_scope end |