class Greedo::ArrayPaginator
Attributes
order[R]
order_by[R]
Public Class Methods
new(records, order, order_by)
click to toggle source
# File lib/greedo/paginator.rb, line 39 def initialize(records, order, order_by) @records = records @order = order @order_by = order_by end
Public Instance Methods
records()
click to toggle source
# File lib/greedo/paginator.rb, line 45 def records @sorted_records ||= sort_records end
show?()
click to toggle source
# File lib/greedo/paginator.rb, line 49 def show? false end
Private Instance Methods
sort_records()
click to toggle source
# File lib/greedo/paginator.rb, line 55 def sort_records sorted = order_by ? @records.sort_by { |r| r.send(order_by) } : @records order == "desc" ? sorted.reverse : sorted end