Module: FlexibleDatatables::SimplePaginator

Defined in:
lib/flexible_datatables/paginators/simple_paginator.rb

Class Method Summary collapse

Class Method Details

.paginate(args = Hash.new) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/flexible_datatables/paginators/simple_paginator.rb', line 3

def self.paginate(args = Hash.new)
  per_page = args.fetch(:length, 0).to_i
  per_page = Configurator.settings.items_per_page unless per_page > 0
  start    = args.fetch(:start, 0).to_i

  records  = args.fetch(:records, [])
  records.slice(start, per_page)
end