Module: Transit::Model::Paginator::Scoping
- Defined in:
- lib/transit/model/paginator.rb
Instance Method Summary collapse
-
#current_page ⇒ Object
Current page number.
-
#first_page? ⇒ Boolean
First page of the collection ?.
-
#last_page? ⇒ Boolean
Last page of the collection?.
-
#total_count ⇒ Object
:nodoc:.
-
#total_pages ⇒ Object
Total number of pages.
Instance Method Details
#current_page ⇒ Object
Current page number
78 79 80 |
# File 'lib/transit/model/paginator.rb', line 78 def current_page ([:skip] / [:limit]) + 1 end |
#first_page? ⇒ Boolean
First page of the collection ?
82 83 84 |
# File 'lib/transit/model/paginator.rb', line 82 def first_page? current_page == 1 end |
#last_page? ⇒ Boolean
Last page of the collection?
86 87 88 |
# File 'lib/transit/model/paginator.rb', line 86 def last_page? current_page >= num_pages end |
#total_count ⇒ Object
:nodoc:
70 71 72 |
# File 'lib/transit/model/paginator.rb', line 70 def total_count #:nodoc: count end |
#total_pages ⇒ Object
Total number of pages
74 75 76 |
# File 'lib/transit/model/paginator.rb', line 74 def total_pages (total_count.to_f / [:limit]).ceil end |