Sha256: d06e904145491f87d84ee31e9833ed08970bdbdf64f9c2dbf05cfe9f4ae9dfdd
Contents?: true
Size: 761 Bytes
Versions: 16
Compression:
Stored size: 761 Bytes
Contents
module Sunspot module Search class CursorPaginatedCollection < Array attr_reader :per_page, :total_count, :current_cursor, :next_page_cursor alias :total_entries :total_count alias :limit_value :per_page def initialize(collection, per_page, total, current_cursor, next_page_cursor) @per_page = per_page @total_count = total @current_cursor = current_cursor @next_page_cursor = next_page_cursor replace collection end def total_pages (total_count.to_f / per_page).ceil end alias :num_pages :total_pages def first_page? current_cursor == '*' end def last_page? count < per_page end end end end
Version data entries
16 entries across 16 versions & 2 rubygems