geared_pagination 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6442a3bf0d55e8a7959814c6fd7d7e02da254952dbd829493aaf99c01bdd85f4
4
- data.tar.gz: d064b59363360f871c6cc91adcce01d4a863d6379282fabb354fbeea0f402cfb
3
+ metadata.gz: c3e2956267a150a716db8afc9a1e0a9b03ac14906162faa283d5de88624b2f21
4
+ data.tar.gz: 85222f625262561aafae1025403375f21adc4fb3b78d750d68929183dcd2269b
5
5
  SHA512:
6
- metadata.gz: becae20eab1dd38355befb8a1440dcd432c0743f94d59f27f7323a7a2386849736605c96ddb344aa45d039569d4a5b406d0732fec2576cdbe093a602084e4fbc
7
- data.tar.gz: 066f7da6d2db1875602aeb1517bf0cb19be41fc142dd3104cd68e0e204b77c3f196cac3ca19604ef75132424a7c6d988352c2e5d5ee1ed651047b4680d5c0c6c
6
+ metadata.gz: ebaba73472a04348a60e2e73b679dc4040f39e9b2193816bdda3c111c3a6dc9d16bcf944d4a4adf3c41b9636f6f4d194d21137dcf652f727e3223ae0576b21b1
7
+ data.tar.gz: 657c6f6d8d0ee877910fb0f394e5229928325af59c471aa48c8bcddb34c75a824a5c92a128bb60757d2178205c914e3aaf3c2c96adcff036fba0098a30c7e3fe
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geared_pagination (0.2)
4
+ geared_pagination (1.0.1)
5
5
  activesupport (>= 5.0)
6
6
  addressable (>= 2.5.0)
7
7
 
@@ -63,8 +63,8 @@ GEM
63
63
  minitest (~> 5.1)
64
64
  tzinfo (~> 1.1)
65
65
  zeitwerk (~> 2.2, >= 2.2.2)
66
- addressable (2.5.2)
67
- public_suffix (>= 2.0.2, < 4.0)
66
+ addressable (2.7.0)
67
+ public_suffix (>= 2.0.2, < 5.0)
68
68
  builder (3.2.4)
69
69
  byebug (10.0.2)
70
70
  concurrent-ruby (1.1.6)
@@ -89,7 +89,7 @@ GEM
89
89
  nio4r (2.5.2)
90
90
  nokogiri (1.10.9)
91
91
  mini_portile2 (~> 2.4.0)
92
- public_suffix (3.0.3)
92
+ public_suffix (4.0.5)
93
93
  rack (2.2.2)
94
94
  rack-test (1.1.0)
95
95
  rack (>= 1.0, < 3)
data/README.md CHANGED
@@ -59,7 +59,7 @@ ORDER BY created_at DESC, id DESC
59
59
  LIMIT 30
60
60
  ```
61
61
 
62
- Geared Pagination supports cursor-based pagination. To use it, pass the `:order_by` option to `set_page_and_extract_portion_from` in your controllers. Provide the orders to apply to the paginated relation:
62
+ Geared Pagination supports cursor-based pagination. To use it, pass the `:ordered_by` option to `set_page_and_extract_portion_from` in your controllers. Provide the orders to apply to the paginated relation:
63
63
 
64
64
  ```ruby
65
65
  set_page_and_extract_portion_from Message.all, ordered_by: { created_at: :desc, id: :desc }
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'geared_pagination'
3
- s.version = '1.0.0'
3
+ s.version = '1.0.1'
4
4
  s.authors = 'David Heinemeier Hansson'
5
5
  s.email = 'david@basecamp.com'
6
6
  s.summary = 'Paginate Active Record sets at variable speeds'
@@ -35,7 +35,7 @@ module GearedPagination
35
35
  end
36
36
 
37
37
  def last?
38
- number == recordset.page_count
38
+ number >= recordset.page_count
39
39
  end
40
40
 
41
41
 
@@ -19,6 +19,11 @@ class GearedPagination::PageTest < ActiveSupport::TestCase
19
19
  assert_not GearedPagination::Recordset.new(Recording.all, per_page: 1).page(1).last?
20
20
  end
21
21
 
22
+ test "last with page number greater than page count" do
23
+ page_for_empty_set = GearedPagination::Recordset.new(Recording.none, per_page: 1000).page(2)
24
+ assert page_for_empty_set.last?
25
+ end
26
+
22
27
  test "next offset param" do
23
28
  assert_equal 2, GearedPagination::Recordset.new(Recording.all, per_page: 1000).page(1).next_param
24
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geared_pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-20 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport