Class: TableSortable::Column::Sorter

Inherits:
Object
  • Object
show all
Includes:
TableSortable::Concerns::Proc
Defined in:
lib/table_sortable/column/sorter.rb

Instance Method Summary collapse

Methods included from TableSortable::Concerns::Proc

#detect_method, #disabled?

Constructor Details

#initialize(*options) ⇒ Sorter

Returns a new instance of Sorter.



6
7
8
# File 'lib/table_sortable/column/sorter.rb', line 6

def initialize(*options)
  super :sort, *options
end

Instance Method Details

#array_procObject



10
11
12
# File 'lib/table_sortable/column/sorter.rb', line 10

def array_proc
  -> (col=nil) { sort{ |a,b| col.value(a) <=> col.value(b) }}
end

#sql_procObject



14
15
16
# File 'lib/table_sortable/column/sorter.rb', line 14

def sql_proc
  -> (col=nil) { order(sorter) }
end