Module: Pagy::OffsetPaginator
- Defined in:
- lib/pagy/toolbox/paginators/offset.rb
Class Method Summary collapse
-
.paginate(collection, options) ⇒ Object
Return the Pagy::Offset instance and results.
Class Method Details
.paginate(collection, options) ⇒ Object
Return the Pagy::Offset instance and results
10 11 12 13 14 15 16 |
# File 'lib/pagy/toolbox/paginators/offset.rb', line 10 def paginate(collection, ) [:page] ||= [:request].resolve_page [:limit] = [:request].resolve_limit [:count] ||= Countable.get_count(collection, ) pagy = Offset.new(**) [pagy, collection.instance_of?(Array) ? collection[pagy.offset, pagy.limit] : pagy.records(collection)] end |