Module: Pagy::CountlessPaginator
- Defined in:
- lib/pagy/toolbox/paginators/countless.rb
Class Method Summary collapse
-
.paginate(collection, options) ⇒ Object
Return the Offset::Countless instance and records.
Class Method Details
.paginate(collection, options) ⇒ Object
Return the Offset::Countless instance and records
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pagy/toolbox/paginators/countless.rb', line 8 def paginate(collection, ) [:page] ||= [:request].resolve_page(force_integer: false) # accept nil and strings if [:page].is_a?(String) page, last = [:page].split.map(&:to_i) # decoded '+' added by the compose_page_url [:page] = page [:last] = last if last&.positive? end [:limit] = [:request].resolve_limit pagy = Offset::Countless.new(**) [pagy, pagy.records(collection)] end |