lib/trestle/table.rb in trestle-0.9.2 vs lib/trestle/table.rb in trestle-0.9.3

- old
+ new

@@ -1,27 +1,26 @@ module Trestle class Table - extend ActiveSupport::Autoload + require_relative "table/automatic" + require_relative "table/builder" + require_relative "table/column" + require_relative "table/actions_column" + require_relative "table/select_column" + require_relative "table/row" - autoload :Automatic - autoload :Builder - autoload :Column - autoload :ActionsColumn - autoload :SelectColumn - autoload :Row - - attr_reader :columns, :options + attr_reader :columns attr_writer :row + attr_accessor :options def initialize(options={}) @options = options @columns = [] end def with_options(opts={}) dup.tap do |table| - table.options.replace(options.merge(opts)) + table.options = options.merge(opts) end end def admin Trestle.lookup(options[:admin]) if options.key?(:admin) @@ -42,21 +41,21 @@ def renderer(template) Renderer.new(self, template) end def row - @row || Row.new(self) + @row || Row.new end class Renderer delegate :options, :header?, to: :@table def initialize(table, template) @table, @template = table, template end def row - @row ||= @table.row.renderer(@template) + @row ||= @table.row.renderer(table: @table, template: @template) end def columns @columns ||= row.columns end