Class: ActionController::Pagination::Paginator::Window
- Inherits:
-
Object
- Object
- ActionController::Pagination::Paginator::Window
- Defined in:
- vendor/plugins/classic_pagination/lib/pagination.rb
Overview
A class for representing ranges around a given page.
Instance Attribute Summary
-
- (Object) first
readonly
Returns the value of attribute first.
-
- (Object) last
readonly
Returns the value of attribute last.
-
- (Object) padding
Returns the value of attribute padding.
-
- (Object) page
readonly
Returns the value of attribute page.
-
- (Object) paginator
readonly
Returns the value of attribute paginator.
Instance Method Summary
-
- (Window) initialize(page, padding = 2)
constructor
Creates a new Window object for the given page with the specified padding.
-
- (Object) pages
(also: #to_a)
Returns an array of Page objects in the current window.
Constructor Details
- (Window) initialize(page, padding = 2)
Creates a new Window object for the given page with the specified padding.
377 378 379 380 381 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 377 def initialize(page, padding=2) @paginator = page.paginator @page = page self.padding = padding end |
Instance Attribute Details
- (Object) first (readonly)
Returns the value of attribute first
394 395 396 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 394 def first @first end |
- (Object) last (readonly)
Returns the value of attribute last
394 395 396 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 394 def last @last end |
- (Object) padding
Returns the value of attribute padding
394 395 396 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 394 def padding @padding end |
- (Object) page (readonly)
Returns the value of attribute page
382 383 384 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 382 def page @page end |
- (Object) paginator (readonly)
Returns the value of attribute paginator
382 383 384 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 382 def paginator @paginator end |
Instance Method Details
- (Object) pages Also known as: to_a
Returns an array of Page objects in the current window.
397 398 399 |
# File 'vendor/plugins/classic_pagination/lib/pagination.rb', line 397 def pages (@first.number..@last.number).to_a.collect! {|n| @paginator[n]} end |