Class: View::Table::Column

Inherits:
Struct
  • Object
show all
Defined in:
lib/view/formatters/table.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) attribute

Returns the value of attribute attribute



118
119
120
# File 'lib/view/formatters/table.rb', line 118

def attribute
  @attribute
end

- (Object) block

Returns the value of attribute block



118
119
120
# File 'lib/view/formatters/table.rb', line 118

def block
  @block
end

- (Object) options

Returns the value of attribute options



118
119
120
# File 'lib/view/formatters/table.rb', line 118

def options
  @options
end

- (Object) table

Returns the value of attribute table



118
119
120
# File 'lib/view/formatters/table.rb', line 118

def table
  @table
end

Instance Method Details

- (Hash) html_options

Html options to add to your td and th tags.



136
137
138
# File 'lib/view/formatters/table.rb', line 136

def html_options
  { :class => attribute }
end

- (Object) name

Returns the name of the column. If the record extends ActiveModel::Translations, it will use human_attribute_name, which gets the translations from I18n. Otherwise it will just titleize the name of the attribute.



126
127
128
129
130
131
132
# File 'lib/view/formatters/table.rb', line 126

def name
  if resource_class.respond_to?(:human_attribute_name)
    resource_class.human_attribute_name(attribute)
  else
    attribute.to_s.titleize
  end
end