Class: SiteSearch::Query::Pagination
- Inherits:
-
Data
- Object
- Data
- SiteSearch::Query::Pagination
- Defined in:
- app/services/site_search/query.rb
Overview
next_page is what drives infinite scroll — nil means the end, so the
client never has to guess whether one more request is worth making.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#next_page ⇒ Object
readonly
Returns the value of attribute next_page.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
Instance Method Summary collapse
-
#as_json ⇒ Hash
The pagination block as the browser consumes it.
-
#initialize(page: 1, next_page: nil, pages: 1, count: 0) ⇒ Pagination
constructor
A new instance of Pagination.
Constructor Details
#initialize(page: 1, next_page: nil, pages: 1, count: 0) ⇒ Pagination
Returns a new instance of Pagination.
35 |
# File 'app/services/site_search/query.rb', line 35 def initialize(page: 1, next_page: nil, pages: 1, count: 0) = super |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count
30 31 32 |
# File 'app/services/site_search/query.rb', line 30 def count @count end |
#next_page ⇒ Object (readonly)
Returns the value of attribute next_page
30 31 32 |
# File 'app/services/site_search/query.rb', line 30 def next_page @next_page end |
#page ⇒ Object (readonly)
Returns the value of attribute page
30 31 32 |
# File 'app/services/site_search/query.rb', line 30 def page @page end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages
30 31 32 |
# File 'app/services/site_search/query.rb', line 30 def pages @pages end |
Instance Method Details
#as_json ⇒ Hash
Returns the pagination block as the browser consumes it.
38 |
# File 'app/services/site_search/query.rb', line 38 def as_json(*) = { page:, next: next_page, pages:, count: } |