Sha256: 2409f48c0fb5efa415b572192307c1c450e3e46d76d248c9fc86797fe9fcb360
Contents?: true
Size: 401 Bytes
Versions: 12
Compression:
Stored size: 401 Bytes
Contents
module BoundedContext module Paginable extend ActiveSupport::Concern included do def paginate(list) list = list.to_a page = params.fetch('page', 1).to_i page_size = params.fetch('size', 10).to_i offset = (page - 1) * page_size { total: list.size, page: page, elements: list[offset, page_size] } end end end end
Version data entries
12 entries across 12 versions & 2 rubygems