dm-pagination 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/dm-pagination/paginator/trio.rb +1 -0
- metadata +1 -1
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@ module DmPagination
|
|
2
2
|
module Paginator
|
3
3
|
class Trio < Base
|
4
4
|
def pages(window = 5, left = 2, right = 2)
|
5
|
+
return [] if num_pages <= 1
|
5
6
|
(1..num_pages).inject([]) do |result, i|
|
6
7
|
i <= left || (num_pages - i) < right || (i-page).abs < window ?
|
7
8
|
result << i : (result.last.nil? ? result : result << nil)
|