Class: Sidekiq::Tasks::Web::Pagination
- Inherits:
-
Object
- Object
- Sidekiq::Tasks::Web::Pagination
- Defined in:
- lib/sidekiq/tasks/web/pagination.rb
Constant Summary collapse
- PREV_LABEL =
"«".freeze
- NEXT_LABEL =
"»".freeze
- ELLIPSIS_LABEL =
"...".freeze
- MIN_PAGE_DISPLAY =
7- PAGE_OFFSET =
2
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#total_pages ⇒ Object
readonly
Returns the value of attribute total_pages.
Instance Method Summary collapse
-
#initialize(current_page, total_pages) ⇒ Pagination
constructor
A new instance of Pagination.
- #links ⇒ Object
Constructor Details
#initialize(current_page, total_pages) ⇒ Pagination
Returns a new instance of Pagination.
13 14 15 16 |
# File 'lib/sidekiq/tasks/web/pagination.rb', line 13 def initialize(current_page, total_pages) @current_page = current_page @total_pages = total_pages end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
11 12 13 |
# File 'lib/sidekiq/tasks/web/pagination.rb', line 11 def current_page @current_page end |
#total_pages ⇒ Object (readonly)
Returns the value of attribute total_pages.
11 12 13 |
# File 'lib/sidekiq/tasks/web/pagination.rb', line 11 def total_pages @total_pages end |
Instance Method Details
#links ⇒ Object
18 19 20 21 22 |
# File 'lib/sidekiq/tasks/web/pagination.rb', line 18 def links return [] if total_pages <= 1 build_links.flatten.compact end |