Class: Sunspot::Query::Pagination
- Inherits:
-
Object
- Object
- Sunspot::Query::Pagination
- Defined in:
- 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
-
#offset ⇒ Object
:nodoc:.
-
#page ⇒ Object
:nodoc:.
-
#per_page ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(page = nil, per_page = nil, offset = nil) ⇒ Pagination
constructor
A new instance of Pagination.
- #to_params ⇒ Object
Constructor Details
#initialize(page = nil, per_page = nil, offset = nil) ⇒ Pagination
Returns a new instance of Pagination.
11 12 13 |
# File '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
#offset ⇒ Object
:nodoc:
9 10 11 |
# File 'lib/sunspot/query/pagination.rb', line 9 def offset @offset end |
#page ⇒ Object
:nodoc:
9 10 11 |
# File 'lib/sunspot/query/pagination.rb', line 9 def page @page end |
#per_page ⇒ Object
:nodoc:
9 10 11 |
# File 'lib/sunspot/query/pagination.rb', line 9 def per_page @per_page end |
Instance Method Details
#to_params ⇒ Object
15 16 17 |
# File 'lib/sunspot/query/pagination.rb', line 15 def to_params { :start => start, :rows => rows } end |