Class: ActiveAdmin::Xls::Builder::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/xls/builder.rb

Overview

Xls column information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, block = nil) ⇒ 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

#dataString, ... (readonly)



293
294
295
# File 'lib/active_admin/xls/builder.rb', line 293

def data
  @data
end

#nameString, Symbol (readonly)



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.

See Also:

  • I18n


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