module SimpleListing::Sortable::ClassMethods

Attributes

sortable_keys[R]
sorting_handlers[R]

Public Instance Methods

sort_by(key, handler_proc) click to toggle source
# File lib/simple_listing/sortable.rb, line 17
def sort_by(key, handler_proc)
  sortable_by key
  @sorting_handlers ||= {}.with_indifferent_access
  @sorting_handlers[key] = handler_proc
end
sortable_by(*keys) click to toggle source
# File lib/simple_listing/sortable.rb, line 11
def sortable_by(*keys)
  @sortable_keys ||= []
  @sortable_keys += keys.map(&:to_s)
  @sortable_keys.uniq!
end