genki-dm-pagination 0.1.2.1 → 0.2.0.0

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.1.2.1"
8
+ GEM_VERSION = "0.2.0.0"
9
9
  AUTHOR = "Genki Takiuchi"
10
10
  EMAIL = "genki@s21g.com"
11
11
  HOMEPAGE = "http://blog.s21g.com/genki"
@@ -6,6 +6,7 @@ module DmPagination
6
6
  @proxy_collection = collection
7
7
  @collection = collection.all(
8
8
  :offset => (@page - 1)*@per_page, :limit => @per_page)
9
+ @num_pages = num_pages
9
10
  end
10
11
 
11
12
  def page
@@ -17,9 +18,9 @@ module DmPagination
17
18
  end
18
19
 
19
20
  def pages(window = 5, left = 2, right = 2)
20
- return [] if num_pages <= 1
21
- (1..num_pages).inject([]) do |result, i|
22
- i <= left || (num_pages - i) < right || (i-page).abs < window ?
21
+ return [] if @num_pages <= 1
22
+ (1..@num_pages).inject([]) do |result, i|
23
+ i <= left || (@num_pages - i) < right || (i-page).abs < window ?
23
24
  result << i : (result.last.nil? ? result : result << nil)
24
25
  end
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genki-dm-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.1
4
+ version: 0.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Takiuchi
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-27 00:00:00 -08:00
12
+ date: 2009-01-28 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: merb
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements: