class Trestle::Table::Builder

Public Class Methods

new(options={}) click to toggle source
# File lib/trestle/table/builder.rb, line 6
def initialize(options={})
  @table = Table.new(options)
  @output_buffer = ActionView::OutputBuffer.new
end

Public Instance Methods

actions(options={}, &block) click to toggle source
# File lib/trestle/table/builder.rb, line 28
def actions(options={}, &block)
  table.columns << ActionsColumn.new(options, &block)
end
column(field, proc=nil, options={}, &block) click to toggle source
# File lib/trestle/table/builder.rb, line 19
def column(field, proc=nil, options={}, &block)
  if proc.is_a?(Hash)
    options = proc
    proc = nil
  end

  table.columns << Column.new(field, options, &(proc || block))
end
row(options={}, &block) click to toggle source
# File lib/trestle/table/builder.rb, line 11
def row(options={}, &block)
  table.row = Row.new(options, &block)
end
selectable_column(options={}) click to toggle source
# File lib/trestle/table/builder.rb, line 15
def selectable_column(options={})
  table.columns << SelectColumn.new(options)
end