class EasyTable::Column

Attributes

name[R]
options[R]
value_block[R]

Public Class Methods

new(name, options = {}, &block) click to toggle source
# File lib/easy_table/column.rb, line 5
def initialize(name, options = {}, &block)
  @name, @options, @value_block = name, options, block
end

Public Instance Methods

header(table, view) click to toggle source
# File lib/easy_table/column.rb, line 9
def header(table, view)
  if options[:header].present?
    options[:header]
  elsif table.model_class
    table.model_class.human_attribute_name(name)
  end
end
td_html() click to toggle source
# File lib/easy_table/column.rb, line 21
def td_html
  Config.td_html
end
th_html() click to toggle source
# File lib/easy_table/column.rb, line 17
def th_html
  Config.th_html
end
value(item, view) click to toggle source
# File lib/easy_table/column.rb, line 25
def value(item, view)
  if value_block
    view.capture(item, &value_block)
  else
    item.send(name)
  end
end