Class: ActionController::Pagination::Paginator::Page

Class | ActionController::Pagination::Paginator::Page
In: | lib/action_controller/pagination.rb
Parent: | Object

A class representing a single page in a paginator.

### Methods

<=> == first? first_item last? last_item new next offset previous to_sql window

### Included Modules

Comparable

### External Aliases

number | -> | to_i

### Attributes

number | [R] |
paginator | [R] |

### Public Class methods

new(paginator, number)

Creates a new Page for the given `paginator` with the index `number`. If `number` is not in the range of valid page numbers or is not a number at all, it defaults to 1.

### Public Instance methods

<=>(page)

Compares two Page objects and returns -1 if the left-hand page comes before the right-hand page, 0 if the pages are equal, and 1 if the left-hand page comes after the right-hand page. Raises ArgumentError if the pages do not belong to the same Paginator object.

==(page)

Compares two Page objects and returns true when they represent the same page (i.e., their paginators are the same and they have the same page number).

first?()

Returns true if this page is the first page in the paginator.

first_item()

Returns the number of the first item displayed.

last?()

Returns true if this page is the last page in the paginator.

last_item()

Returns the number of the last item displayed.

next()

Returns a new Page object representing the page just after this page, or nil if this is the last page.

offset()

Returns the item offset for the first item in this page.

previous()

Returns a new Page object representing the page just before this page, or nil if this is the first page.

to_sql()

Returns the limit/offset array for this page.

window(padding=2)

Returns a new Window object for this page with the specified `padding`.

[Validate]