Class: Edools::PaginatedCollection
- Inherits:
-
ActiveResource::Collection
- Object
- ActiveResource::Collection
- Edools::PaginatedCollection
- Defined in:
- lib/edools/paginated_collection.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Our custom array to handle pagination methods.
-
#per_page ⇒ Object
Our custom array to handle pagination methods.
-
#total_count ⇒ Object
Our custom array to handle pagination methods.
-
#total_pages ⇒ Object
Our custom array to handle pagination methods.
Instance Method Summary collapse
-
#initialize(parsed = {}) ⇒ PaginatedCollection
constructor
The initialize method will receive the ActiveResource parsed result and set @elements.
Constructor Details
#initialize(parsed = {}) ⇒ PaginatedCollection
The initialize method will receive the ActiveResource parsed result and set @elements.
11 12 13 14 15 16 17 |
# File 'lib/edools/paginated_collection.rb', line 11 def initialize(parsed = {}) @elements = parsed[resource_key(parsed.keys)] @total_pages = parsed["total_pages"] @per_page = parsed["per_page"] @total_count = parsed["total_count"] @current_page = parsed["current_page"] end |
Instance Attribute Details
#current_page ⇒ Object
Our custom array to handle pagination methods
7 8 9 |
# File 'lib/edools/paginated_collection.rb', line 7 def current_page @current_page end |
#per_page ⇒ Object
Our custom array to handle pagination methods
7 8 9 |
# File 'lib/edools/paginated_collection.rb', line 7 def per_page @per_page end |
#total_count ⇒ Object
Our custom array to handle pagination methods
7 8 9 |
# File 'lib/edools/paginated_collection.rb', line 7 def total_count @total_count end |
#total_pages ⇒ Object
Our custom array to handle pagination methods
7 8 9 |
# File 'lib/edools/paginated_collection.rb', line 7 def total_pages @total_pages end |