paginator 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.txt +13 -13
  2. data/lib/paginator.rb +2 -2
  3. metadata +2 -2
data/README.txt CHANGED
@@ -22,11 +22,11 @@ You could, of course, just pass in the number of items per page directly to the
22
22
  === In a Rails Application
23
23
 
24
24
  def index
25
- @pager = ::Paginator.new(Foo.count, PER_PAGE) do |offset, per_page|
26
- Foo.find(:all, :limit => per_page, :offset => offset)
27
- end
28
- @page = @pager.page(params[:page])
29
- # respond_to here if you want it
25
+ @pager = ::Paginator.new(Foo.count, PER_PAGE) do |offset, per_page|
26
+ Foo.find(:all, :limit => per_page, :offset => offset)
27
+ end
28
+ @page = @pager.page(params[:page])
29
+ # respond_to here if you want it
30
30
  end
31
31
 
32
32
  # In your view
@@ -40,15 +40,15 @@ You could, of course, just pass in the number of items per page directly to the
40
40
  === Anything else
41
41
 
42
42
  bunch_o_data = (1..60).to_a
43
- pager = Paginator.new(bunch_o_data.size, PER_PAGE) do |offset, per_page|
44
- bunch_o_data[offset,per_page]
45
- end
46
- pager.each do |page|
47
- puts "Page ##{page.number}"
48
- page.each do |item|
49
- puts item
43
+ pager = Paginator.new(bunch_o_data.size, PER_PAGE) do |offset, per_page|
44
+ bunch_o_data[offset,per_page]
45
+ end
46
+ pager.each do |page|
47
+ puts "Page ##{page.number}"
48
+ page.each do |item|
49
+ puts item
50
50
  end
51
- end
51
+ end
52
52
 
53
53
  == REQUIREMENTS:
54
54
 
@@ -2,13 +2,13 @@ require 'forwardable'
2
2
 
3
3
  class Paginator
4
4
 
5
- VERSION = '1.0.6'
5
+ VERSION = '1.0.7'
6
6
 
7
7
  class ArgumentError < ::ArgumentError; end
8
8
  class MissingCountError < ArgumentError; end
9
9
  class MissingSelectError < ArgumentError; end
10
10
 
11
- attr_reader :per_page
11
+ attr_reader :per_page, :count
12
12
 
13
13
  # Instantiate a new Paginator object
14
14
  #
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.6
7
- date: 2006-11-02 00:00:00 -07:00
6
+ version: 1.0.7
7
+ date: 2006-11-29 00:00:00 -07:00
8
8
  summary: A generic paginator object for use in any Ruby program
9
9
  require_paths:
10
10
  - lib