class ActiveAdmin::Xls::Builder::Column
Xls
column information
Attributes
data[R]
@return [String, Symbol, Proc] The column name used to look up the
value, or a block used to generate the value to display.
name[R]
@return [String, Symbol] Column
name
Public Class Methods
new(name, block = nil)
click to toggle source
@param name [String, Symbol] Name of the column. If the name of the
column is an existing attribute of the resource class, the value can be retreived automatically if no block is specified
@param block [Proc] A procedure to generate data for the column
instead of retreiving the value from the resource directly
# File lib/active_admin/xls/builder.rb, line 283 def initialize(name, block = nil) @name = name @data = block || @name end
Public Instance Methods
localized_name(i18n_scope = nil)
click to toggle source
Returns a localized version of the column name if a scope is given. Otherwise, it returns the titleized column name without translation.
@param i18n_scope [String, Symbol, Array<String>, Array<Symbol>]
Translation scope. If not provided, the column name will be used.
@see I18n
# 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