Class: Waistband::Query
- Inherits:
-
Object
- Object
- Waistband::Query
- Includes:
- QueryHelpers
- Defined in:
- lib/waistband/query.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
Returns the value of attribute page.
-
#page_size ⇒ Object
Returns the value of attribute page_size.
Instance Method Summary collapse
-
#initialize(index, options = {}) ⇒ Query
constructor
A new instance of Query.
- #prepare(hash = {}) ⇒ Object
Methods included from QueryHelpers
#hits, #paginated_results, #results, #total_results
Constructor Details
#initialize(index, options = {}) ⇒ Query
Returns a new instance of Query.
10 11 12 13 14 15 |
# File 'lib/waistband/query.rb', line 10 def initialize(index, = {}) @index = index @page = ([:page] || 1).to_i @page_size = ([:page_size] || 20).to_i prepare end |
Instance Attribute Details
#page ⇒ Object
Returns the value of attribute page.
8 9 10 |
# File 'lib/waistband/query.rb', line 8 def page @page end |
#page_size ⇒ Object
Returns the value of attribute page_size.
8 9 10 |
# File 'lib/waistband/query.rb', line 8 def page_size @page_size end |
Instance Method Details
#prepare(hash = {}) ⇒ Object
17 18 19 20 |
# File 'lib/waistband/query.rb', line 17 def prepare(hash = {}) @hash = hash.with_indifferent_access self end |