Sha256: d90380a4e04d0624956121fd8148b78d63e261f71497bfbe9f98ef9bef710923
Contents?: true
Size: 594 Bytes
Versions: 6
Compression:
Stored size: 594 Bytes
Contents
# frozen_string_literal: true module Care::AutoFinder # # Содержит методы для пагинации коллекции # # @example # class Finder # include Paginateble # # attr_reader :params # # def call # params = { page: 2, limit: 10 } # by_page(Document) # end # end # module Paginateble DEFAULT_LIMIT = 100 def by_page(items) params[:page].present? ? items.page(params[:page]).per(params[:limit] || DEFAULT_LIMIT) : items end def paginate(items) by_page(items) end end end
Version data entries
6 entries across 6 versions & 1 rubygems