Class Paginator
In: lib/paginator.rb
Parent: Object
Paginator Enumerable dot/f_3.png

Methods

each   first   last   new   number_of_pages   page  

Included Modules

Enumerable

Classes and Modules

Class Paginator::ArgumentError
Class Paginator::MissingCountError
Class Paginator::MissingSelectError
Class Paginator::Page

Constants

VERSION = '1.1.0'

Attributes

count  [R] 
per_page  [R] 

Public Class methods

Instantiate a new Paginator object

Provide:

  • A total count of the number of objects to paginate
  • The number of objects in each page
  • A block that returns the array of items
    • The block is passed the item offset (and the number of items to show per page, for convenience, if the arity is 2)

Public Instance methods

First page object

Last page object

Total number of pages

Retrieve page object by number

[Validate]