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 28 def action(&block) @action_columns << ActionColumn.new("", {}, &block) end
all_columns()
click to toggle source
# File lib/easy_table/base.rb, line 32 def all_columns @all_columns ||= (columns + action_columns) end
process_options()
click to toggle source
# File lib/easy_table/base.rb, line 36 def process_options @model_class = options[:model_class] || NilModelClass.instance end
td(name, options = {}, &block)
click to toggle source
TODO: spec & doc for using option
# File lib/easy_table/base.rb, line 23 def td(name, options = {}, &block) column_class = options.delete(:using) || Column @columns << column_class.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