Class Webby::Paginator
In: lib/webby/stelan/paginator.rb
Parent: Object

Methods

each   first   last   new   number_of_pages   page   reset  

Included Modules

Enumerable

Classes and Modules

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

Attributes

count  [R] 
directory  [R] 
filename  [R] 
per_page  [R] 
resource  [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

Finalizer method that should be called when the paginator is finished

[Validate]