class Trestle::Table::Column
Attributes
block[R]
field[R]
options[R]
Public Class Methods
new(field, options={}, &block)
click to toggle source
# File lib/trestle/table/column.rb, line 6 def initialize(field, options={}, &block) @field, @options = field, options @block = block if block_given? end
Public Instance Methods
renderer(table:, template:)
click to toggle source
# File lib/trestle/table/column.rb, line 11 def renderer(table:, template:) Renderer.new(self, table: table, template: template) end
sort_field()
click to toggle source
# File lib/trestle/table/column.rb, line 19 def sort_field if options[:sort].is_a?(Hash) options[:sort][:field] || field else options[:sort] || field end end
sort_options()
click to toggle source
# File lib/trestle/table/column.rb, line 27 def sort_options options[:sort].is_a?(Hash) ? options[:sort] : {} end
sortable?()
click to toggle source
# File lib/trestle/table/column.rb, line 15 def sortable? options[:sort] != false && (!@block || options.has_key?(:sort)) end