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

collection[R]

@!attribute [r] collection

@return [Object] the collection this adapter is working with

Public Class Methods

new(collection) click to toggle source

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

current_page() click to toggle source

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
next_page() click to toggle source

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
per_page() click to toggle source

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
previous_page() click to toggle source

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
total_entries() click to toggle source

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
total_pages() click to toggle source

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