Module: Slingshot::Results::Pagination
- Included in:
- Collection
- Defined in:
- lib/slingshot/results/pagination.rb
Instance Method Summary collapse
- #current_page ⇒ Object
- #next_page ⇒ Object
- #previous_page ⇒ Object
- #total_entries ⇒ Object
- #total_pages ⇒ Object
Instance Method Details
#current_page ⇒ Object
15 16 17 |
# File 'lib/slingshot/results/pagination.rb', line 15 def current_page @options[:page].to_i end |
#next_page ⇒ Object
23 24 25 |
# File 'lib/slingshot/results/pagination.rb', line 23 def next_page @options[:page].to_i + 1 end |
#previous_page ⇒ Object
19 20 21 |
# File 'lib/slingshot/results/pagination.rb', line 19 def previous_page @options[:page].to_i - 1 end |
#total_entries ⇒ Object
6 7 8 |
# File 'lib/slingshot/results/pagination.rb', line 6 def total_entries @total end |
#total_pages ⇒ Object
10 11 12 13 |
# File 'lib/slingshot/results/pagination.rb', line 10 def total_pages result = @total.to_f / (@options[:per_page] ? @options[:per_page].to_i : 10 ) result < 1 ? 1 : result.round end |