Class: Core::Endpoint::BasicHandler::Paged::PagedTarget::PageOfResults
- Inherits:
-
Object
- Object
- Core::Endpoint::BasicHandler::Paged::PagedTarget::PageOfResults
- Defined in:
- app/api/core/endpoint/basic_handler/paged.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
(also: #current_page)
readonly
Returns the value of attribute page.
-
#total_pages ⇒ Object
readonly
Returns the value of attribute total_pages.
Instance Method Summary collapse
-
#initialize(page, _total, per_page) ⇒ PageOfResults
constructor
A new instance of PageOfResults.
- #next_page ⇒ Object
- #previous_page ⇒ Object
Constructor Details
#initialize(page, _total, per_page) ⇒ PageOfResults
Returns a new instance of PageOfResults.
65 66 67 |
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 65 def initialize(page, _total, per_page) @page, @total_pages = page, page / per_page end |
Instance Attribute Details
#page ⇒ Object (readonly) Also known as: current_page
Returns the value of attribute page.
69 70 71 |
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 69 def page @page end |
#total_pages ⇒ Object (readonly)
Returns the value of attribute total_pages.
69 70 71 |
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 69 def total_pages @total_pages end |
Instance Method Details
#next_page ⇒ Object
72 73 74 |
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 72 def next_page page + 1 end |
#previous_page ⇒ Object
76 77 78 |
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 76 def previous_page page - 1 end |