Class: Her::PaginatedCollection
Instance Attribute Summary
Attributes inherited from Collection
#errors, #metadata
Instance Method Summary
collapse
Methods inherited from Collection
#initialize
Instance Method Details
#current_page ⇒ Object
3
4
5
|
# File 'lib/her/paginated_collection.rb', line 3
def current_page
metadata[:current_page].to_i
end
|
#per_page ⇒ Object
7
8
9
|
# File 'lib/her/paginated_collection.rb', line 7
def per_page
metadata[:per_page].to_i
end
|
#total_entries ⇒ Object
11
12
13
|
# File 'lib/her/paginated_collection.rb', line 11
def total_entries
metadata[:total_entries].to_i
end
|
#total_pages ⇒ Object
15
16
17
18
|
# File 'lib/her/paginated_collection.rb', line 15
def total_pages
return 0 if total_entries == 0 || per_page == 0
(total_entries.to_f / per_page).ceil
end
|