module FlexibleDatatables::SimplePaginator

Public Class Methods

paginate(args = Hash.new) click to toggle source
# 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