Class: Sunspot::Query::Pagination
- Inherits:
-
Object
- Object
- Sunspot::Query::Pagination
- Defined in:
- sunspot/lib/sunspot/query/pagination.rb
Overview
A query component that holds information about pagination. Unlike other query components, this one is mutable, because the query itself holds a reference to it and updates it if pagination is changed.
Instance Attribute Summary (collapse)
-
- (Object) offset
:nodoc:.
-
- (Object) page
:nodoc:.
-
- (Object) per_page
:nodoc:.
Instance Method Summary (collapse)
-
- (Pagination) initialize(page = nil, per_page = nil, offset = nil)
constructor
A new instance of Pagination.
- - (Object) to_params
Constructor Details
- (Pagination) initialize(page = nil, per_page = nil, offset = nil)
A new instance of Pagination
11 12 13 |
# File 'sunspot/lib/sunspot/query/pagination.rb', line 11 def initialize(page = nil, per_page = nil, offset = nil) self.offset, self.page, self.per_page = offset, page, per_page end |
Instance Attribute Details
- (Object) offset
:nodoc:
9 10 11 |
# File 'sunspot/lib/sunspot/query/pagination.rb', line 9 def offset @offset end |
- (Object) page
:nodoc:
9 10 11 |
# File 'sunspot/lib/sunspot/query/pagination.rb', line 9 def page @page end |
- (Object) per_page
:nodoc:
9 10 11 |
# File 'sunspot/lib/sunspot/query/pagination.rb', line 9 def per_page @per_page end |
Instance Method Details
- (Object) to_params
15 16 17 |
# File 'sunspot/lib/sunspot/query/pagination.rb', line 15 def to_params { :start => start, :rows => rows } end |