A class for representing ranges around a given page.

Methods
Attributes
[R] first
[R] last
[R] padding
[R] page
[R] paginator
Public Class methods
new(page, padding=2)

Creates a new Window object for the given page with the specified padding.

     # File vendor/rails/actionpack/lib/action_controller/pagination.rb, line 350
350:         def initialize(page, padding=2)
351:           @paginator = page.paginator
352:           @page = page
353:           self.padding = padding
354:         end
Public Instance methods
padding=(padding)

Sets the window’s padding (the number of pages on either side of the window page).

     # File vendor/rails/actionpack/lib/action_controller/pagination.rb, line 359
359:         def padding=(padding)
360:           @padding = padding < 0 ? 0 : padding
361:           # Find the beginning and end pages of the window
362:           @first = @paginator.has_page_number?(@page.number - @padding) ?
363:             @paginator[@page.number - @padding] : @paginator.first
364:           @last =  @paginator.has_page_number?(@page.number + @padding) ?
365:             @paginator[@page.number + @padding] : @paginator.last
366:         end
pages()

Returns an array of Page objects in the current window.

This method is also aliased as to_a
     # File vendor/rails/actionpack/lib/action_controller/pagination.rb, line 370
370:         def pages
371:           (@first.number..@last.number).to_a.map {|n| @paginator[n]}
372:         end
to_a()

Alias for pages