class EasyTable::Base

Attributes

action_columns[R]
columns[R]
items[R]
model_class[R]
options[R]
presenter[RW]

Public Class Methods

new(items, options = {}) click to toggle source

options:

model_class: the class of the model, used for i18n, using with the human_attribute_name
# File lib/easy_table/base.rb, line 10
def initialize(items, options = {})
  @items          = items
  @options        = options
  @columns        = []
  @action_columns = []
  process_options
end

Public Instance Methods

action(&block) click to toggle source
# File lib/easy_table/base.rb, line 26
def action(&block)
  @action_columns << ActionColumn.new("", {}, &block)
end
all_columns() click to toggle source
# File lib/easy_table/base.rb, line 30
def all_columns
  @all_columns ||= (columns + action_columns)
end
process_options() click to toggle source
# File lib/easy_table/base.rb, line 34
def process_options
  @model_class = options[:model_class] || NilModelClass.instance
end
td(name, options = {}, &block) click to toggle source
# File lib/easy_table/base.rb, line 22
def td(name, options = {}, &block)
  @columns << Column.new(name, options, &block)
end
tds(*names) click to toggle source
# File lib/easy_table/base.rb, line 18
def tds(*names)
  names.each { |name| td(name) }
end