Class: JSOM::Pagination::Paginator
- Inherits:
-
Object
- Object
- JSOM::Pagination::Paginator
- Defined in:
- lib/jsom/pagination/paginator.rb
Instance Method Summary collapse
Instance Method Details
#call(collection, params:, base_url: '') ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jsom/pagination/paginator.rb', line 6 def call(collection, params:, base_url: '') @page = Page.new(params) pagy, records = pagy_custom(collection, page: page) = MetaData.new(total: pagy.count, pages: pagy.pages) # pagy methods: :count, :page, :items, :vars, :pages, :last, :offset, :from, :to, :prev, :next links = Links.new(page: page, total_pages: pagy.pages, url: base_url) Collection.new(items: records, links: links, meta: ) end |