Class: Sunspot::Query::Pagination

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(configuration, page = nil, per_page = nil) ⇒ Pagination

Returns a new instance of Pagination.



11
12
13
14
# File 'lib/sunspot/query/pagination.rb', line 11

def initialize(configuration, page = nil, per_page = nil)
  @configuration = configuration
  self.page, self.per_page = page, per_page
end

Instance Attribute Details

#pageObject

:nodoc:



9
10
11
# File 'lib/sunspot/query/pagination.rb', line 9

def page
  @page
end

#per_pageObject

:nodoc:



9
10
11
# File 'lib/sunspot/query/pagination.rb', line 9

def per_page
  @per_page
end

Instance Method Details

#to_paramsObject



16
17
18
# File 'lib/sunspot/query/pagination.rb', line 16

def to_params
  { :start => start, :rows => rows }
end