paginator 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/paginator.rb +4 -3
- data/test/test_paginator.rb +9 -0
- metadata +2 -2
data/History.txt
CHANGED
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.9'
|
6
6
|
|
7
7
|
class ArgumentError < ::ArgumentError; end
|
8
8
|
class MissingCountError < ArgumentError; end
|
@@ -29,7 +29,7 @@ class Paginator
|
|
29
29
|
|
30
30
|
# Total number of pages
|
31
31
|
def number_of_pages
|
32
|
-
|
32
|
+
(@count / @per_page).to_i + (@count % @per_page > 0 ? 1 : 0)
|
33
33
|
end
|
34
34
|
|
35
35
|
# First page object
|
@@ -113,11 +113,12 @@ class Paginator
|
|
113
113
|
@pager.page(@number + 1) if next?
|
114
114
|
end
|
115
115
|
|
116
|
-
#
|
116
|
+
# The "item number" of the first item on this page
|
117
117
|
def first_item_number
|
118
118
|
1 + @offset
|
119
119
|
end
|
120
120
|
|
121
|
+
# The "item number" of the last item on this page
|
121
122
|
def last_item_number
|
122
123
|
if next?
|
123
124
|
@offset + @pager.per_page
|
data/test/test_paginator.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: paginator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.9
|
7
|
+
date: 2007-02-17 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
|