Class: Card::PagingLinks
- Defined in:
- mod/collection/lib/card/paging_links.rb
Overview
generates pagination links
Constant Summary collapse
- MAX_PAGES =
100
Instance Method Summary collapse
-
#build(window = 2) {|text, page, status, options| ... } ⇒ Array<String>
@example: current page = 5, window = 2 « 1 … 3 4 [5] 6 7 … 10 » . -
#initialize(total_pages, current_page) ⇒ PagingLinks
constructor
A new instance of PagingLinks.
Constructor Details
#initialize(total_pages, current_page) ⇒ PagingLinks
Returns a new instance of PagingLinks.
6 7 8 9 |
# File 'mod/collection/lib/card/paging_links.rb', line 6 def initialize total_pages, current_page @total = total_pages @current = current_page end |
Instance Method Details
#build(window = 2) {|text, page, status, options| ... } ⇒ Array<String>
@example: current page = 5, window = 2 |«|1|…|3|4|[5]|6|7|…|10|»|
19 20 21 22 |
# File 'mod/collection/lib/card/paging_links.rb', line 19 def build window=2, &block @render_item = block links window end |