Sha256: 7cc3197e62a571e94aaedfc1407ffa2763f30c2933289d22871bbbb7c9b043f0

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

module Trestle
  class Table
    class Builder < Trestle::Builder
      target :table

      def initialize(options={})
        @table = Table.new(options)
      end

      def row(options={}, &block)
        table.row = Row.new(table, options, &block)
      end

      def selectable_column
        table.columns << SelectColumn.new(table)
      end

      def column(field, proc=nil, options={}, &block)
        if proc.is_a?(Hash)
          options = proc
          proc = nil
        end

        table.columns << Column.new(table, field, options, &(proc || block))
      end

      def actions(&block)
        table.columns << ActionsColumn.new(table, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trestle-0.8.3 lib/trestle/table/builder.rb