Class: RestfulResource::PaginatedArray
- Inherits:
-
Array
- Object
- Array
- RestfulResource::PaginatedArray
- Defined in:
- lib/restful_resource/paginated_array.rb
Instance Method Summary collapse
-
#initialize(original_array, previous_page_url:, next_page_url:, total_count:) ⇒ PaginatedArray
constructor
A new instance of PaginatedArray.
- #next_page ⇒ Object
- #previous_page ⇒ Object
- #total_count ⇒ Object
Constructor Details
#initialize(original_array, previous_page_url:, next_page_url:, total_count:) ⇒ PaginatedArray
Returns a new instance of PaginatedArray.
3 4 5 6 7 8 9 |
# File 'lib/restful_resource/paginated_array.rb', line 3 def initialize(original_array, previous_page_url:, next_page_url:, total_count: ) super(original_array) @previous_page_url = previous_page_url @next_page_url = next_page_url @total_count = total_count end |
Instance Method Details
#next_page ⇒ Object
15 16 17 |
# File 'lib/restful_resource/paginated_array.rb', line 15 def next_page get_page_from_url(@next_page_url) end |
#previous_page ⇒ Object
11 12 13 |
# File 'lib/restful_resource/paginated_array.rb', line 11 def previous_page get_page_from_url(@previous_page_url) end |
#total_count ⇒ Object
19 20 21 |
# File 'lib/restful_resource/paginated_array.rb', line 19 def total_count @total_count.to_i end |