paginator 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/README.txt +1 -1
- data/lib/paginator.rb +2 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.0.3 / 2006-10-26
|
2
|
+
|
3
|
+
* Documentation fix
|
4
|
+
|
5
|
+
== 1.0.2 / 2006-10-25
|
6
|
+
|
7
|
+
* If the block passed during Paginator has an arity of 1, the number
|
8
|
+
of items per page will not be yielded to the block.
|
9
|
+
|
1
10
|
== 1.0.1 / 2006-10-24
|
2
11
|
|
3
12
|
* Made Paginator#page more accepting, and set it to default to 1
|
data/README.txt
CHANGED
@@ -19,7 +19,7 @@ set of objects based on the offset and number of objects per page.
|
|
19
19
|
|
20
20
|
# In your controller
|
21
21
|
PER_PAGE = 20
|
22
|
-
@pager = Paginator.new(Foo.count, PER_PAGE) do |offset, per_page|
|
22
|
+
@pager = ::Paginator.new(Foo.count, PER_PAGE) do |offset, per_page|
|
23
23
|
Foo.find(:all, :limit => per_page, :offset => offset)
|
24
24
|
end
|
25
25
|
@page = @pager.page(params[:page])
|
data/lib/paginator.rb
CHANGED
@@ -2,7 +2,7 @@ require 'forwardable'
|
|
2
2
|
|
3
3
|
class Paginator
|
4
4
|
|
5
|
-
VERSION = '1.0.
|
5
|
+
VERSION = '1.0.3'
|
6
6
|
|
7
7
|
class ArgumentError < ::ArgumentError; end
|
8
8
|
class MissingCountError < ArgumentError; end
|
@@ -18,7 +18,7 @@ class Paginator
|
|
18
18
|
# * A block that returns the array of items
|
19
19
|
# * The block is passed the item offset
|
20
20
|
# (and the number of items to show per page, for
|
21
|
-
# convenience)
|
21
|
+
# convenience, if the arity is 2)
|
22
22
|
def initialize(count, per_page, &select)
|
23
23
|
@count, @per_page = count, per_page
|
24
24
|
unless select
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: paginator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2006-10-
|
6
|
+
version: 1.0.3
|
7
|
+
date: 2006-10-25 00:00:00 -06:00
|
8
8
|
summary: A generic paginator object for use in any Ruby program
|
9
9
|
require_paths:
|
10
10
|
- lib
|