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 CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "dm-pagination"
8
- GEM_VERSION = "0.3.1"
8
+ GEM_VERSION = "0.3.2"
9
9
  AUTHOR = "Genki Takiuchi"
10
10
  EMAIL = "genki@s21g.com"
11
11
  HOMEPAGE = "http://blog.s21g.com/genki"
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Takiuchi