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

#attributeObject

Returns the value of attribute attribute

Returns:

  • (Object)

    the current value of attribute



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

def attribute
  @attribute
end

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



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

def block
  @block
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



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

def options
  @options
end

#tableObject

Returns the value of attribute table

Returns:

  • (Object)

    the current value of table



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

def table
  @table
end

Instance Method Details

#html_optionsHash

Html options to add to your td and th tags.

Returns:

  • (Hash)


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

def html_options
  { :class => attribute }
end

#nameObject

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