class Pragma::Decorator::Pagination::Adapter::Base
This is the base pagination adapter.
@abstract Subclass and override the abstract methods to implement an adapter
@api private
Attributes
@!attribute [r] collection
@return [Object] the collection this adapter is working with
Public Class Methods
Initializes the adapter.
@param collection [Object] the collection to work with
# File lib/pragma/decorator/pagination/adapter/base.rb, line 20 def initialize(collection) @collection = collection end
Public Instance Methods
Returns the number of the current page.
@return [Integer] the number of the current page
# File lib/pragma/decorator/pagination/adapter/base.rb, line 55 def current_page fail NotImplementedError end
Returns the number of the next page, if any.
@return [Integer|NilClass] the number of the next page, if any
# File lib/pragma/decorator/pagination/adapter/base.rb, line 62 def next_page fail NotImplementedError end
Returns the number of entries per page in the collection.
@return [Integer] the number of entries per page in the collection
# File lib/pragma/decorator/pagination/adapter/base.rb, line 34 def per_page fail NotImplementedError end
Returns the number of the previous page, if any.
@return [Integer|NilClass] the number of the previous page, if any
# File lib/pragma/decorator/pagination/adapter/base.rb, line 48 def previous_page fail NotImplementedError end
Returns the total number of entries in the collection.
@return [Integer] the total number of entries in the collection
# File lib/pragma/decorator/pagination/adapter/base.rb, line 27 def total_entries fail NotImplementedError end
Returns the total number of pages in the collection.
@return [Integer] the total number of pages in the collection
# File lib/pragma/decorator/pagination/adapter/base.rb, line 41 def total_pages fail NotImplementedError end