next_page 1.0.0 → 1.1.0

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: 38c9e0beeee5d1e9d2e9a4a85e25fdf5011c6d9116dcb35ffdaaddfa795a3cca
4
- data.tar.gz: 408c859f1330a3ce2a577d43f8af4bbf390031d4a5aca33c1a40f7d2ba29465b
3
+ metadata.gz: 1cc73f97e32970013870bc90c44060f70a64bdd296a7a62591b0f5a1eba363ba
4
+ data.tar.gz: 628eee3dedc5b340a20aebee307046118b2c798a0c523ec32d4abf80ac552223
5
5
  SHA512:
6
- metadata.gz: b2ef11040267561b0daf6174b766c374b998a3effe8c2de9e76b13980386d98bb3b4562e2858a3e70a700a2d45154f6dcd381951dbc997f20af1c99d9435b98e
7
- data.tar.gz: 7267d87c88104d59d007b6b986fd398853f2591a2b87c25293986fa0fd5559dd7bc08bca4b0a33683f34656165ac3b6490a86d86c7d0f2d647950d558da6dc56
6
+ metadata.gz: d919ec3c531bd509a49bb250ee5bda3062c377cdcdda9ee9de25c3e8db3ae4e2405d65227d76b254f9978cf62e8b7741a7a824d53defe75c5c98b62e6d784d5a
7
+ data.tar.gz: 30dec7d71f321f5834c6b91450dacfe7397a2597dbfe19b13f0ed9e73085b0c5791fc3359625de09a5815656403772f05030648fb502305556ac3a5300de2af0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Rockridge Solutions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -34,7 +34,7 @@ end
34
34
 
35
35
  ## Getting Started
36
36
 
37
- This gem requires Rails 7.1+ and works with ActiveRecord.
37
+ This gem requires Rails 7.2+ and works with ActiveRecord.
38
38
 
39
39
  ### Installation
40
40
 
@@ -144,7 +144,7 @@ is also used manually to assess the codeline.
144
144
 
145
145
  ### Running Tests
146
146
 
147
- Tests are written in RSpec and the dummy app uses a docker database.
147
+ Tests are written in RSpec and the dummy app uses a sqlite database.
148
148
 
149
149
  The tests can also be run across all the ruby and Rails combinations using appraisal. The install is a one-time step.
150
150
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/concern'
4
+
3
5
  module NextPage
4
6
  # # Pagination
5
7
  #
@@ -12,14 +12,22 @@ module NextPage
12
12
  #
13
13
  # These can be completed after the call to `paginate_resource`.
14
14
  module PaginationAttributes
15
- attr_writer :count_query, :current_page, :total_count, :per_page
15
+ attr_writer :count_query, :total_count
16
+
17
+ def current_page=(value)
18
+ @current_page = [value.to_i, 1].max
19
+ end
20
+
21
+ def per_page=(value)
22
+ @per_page = [value.to_i, 1].max
23
+ end
16
24
 
17
25
  def previous_page
18
26
  current_page > 1 ? current_page - 1 : nil
19
27
  end
20
28
 
21
29
  def current_page
22
- @current_page ||= (count_query.offset_value || 0) + 1
30
+ @current_page ||= 1
23
31
  end
24
32
 
25
33
  def next_page
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NextPage
2
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.1.0'.freeze
3
5
  end
metadata CHANGED
@@ -1,113 +1,84 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: next_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Kummer
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-04-23 00:00:00.000000000 Z
10
+ date: 2026-04-01 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: rails
13
+ name: activerecord
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 7.1.5
18
+ version: '7.2'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 7.1.5
27
- - !ruby/object:Gem::Dependency
28
- name: appraisal
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 2.5.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 2.5.0
41
- - !ruby/object:Gem::Dependency
42
- name: guard
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.19'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.19'
25
+ version: '7.2'
55
26
  - !ruby/object:Gem::Dependency
56
- name: guard-rspec
27
+ name: rails
57
28
  requirement: !ruby/object:Gem::Requirement
58
29
  requirements:
59
- - - "~>"
30
+ - - ">="
60
31
  - !ruby/object:Gem::Version
61
- version: '4.7'
32
+ version: '7.2'
62
33
  type: :development
63
34
  prerelease: false
64
35
  version_requirements: !ruby/object:Gem::Requirement
65
36
  requirements:
66
- - - "~>"
37
+ - - ">="
67
38
  - !ruby/object:Gem::Version
68
- version: '4.7'
39
+ version: '7.2'
69
40
  - !ruby/object:Gem::Dependency
70
- name: guard-rubocop
41
+ name: appraisal
71
42
  requirement: !ruby/object:Gem::Requirement
72
43
  requirements:
73
44
  - - "~>"
74
45
  - !ruby/object:Gem::Version
75
- version: '1.5'
46
+ version: 2.5.0
76
47
  type: :development
77
48
  prerelease: false
78
49
  version_requirements: !ruby/object:Gem::Requirement
79
50
  requirements:
80
51
  - - "~>"
81
52
  - !ruby/object:Gem::Version
82
- version: '1.5'
53
+ version: 2.5.0
83
54
  - !ruby/object:Gem::Dependency
84
- name: pg
55
+ name: sqlite3
85
56
  requirement: !ruby/object:Gem::Requirement
86
57
  requirements:
87
58
  - - "~>"
88
59
  - !ruby/object:Gem::Version
89
- version: 1.5.4
60
+ version: '2.1'
90
61
  type: :development
91
62
  prerelease: false
92
63
  version_requirements: !ruby/object:Gem::Requirement
93
64
  requirements:
94
65
  - - "~>"
95
66
  - !ruby/object:Gem::Version
96
- version: 1.5.4
67
+ version: '2.1'
97
68
  - !ruby/object:Gem::Dependency
98
69
  name: rspec-rails
99
70
  requirement: !ruby/object:Gem::Requirement
100
71
  requirements:
101
72
  - - "~>"
102
73
  - !ruby/object:Gem::Version
103
- version: '7.0'
74
+ version: '8.0'
104
75
  type: :development
105
76
  prerelease: false
106
77
  version_requirements: !ruby/object:Gem::Requirement
107
78
  requirements:
108
79
  - - "~>"
109
80
  - !ruby/object:Gem::Version
110
- version: '7.0'
81
+ version: '8.0'
111
82
  - !ruby/object:Gem::Dependency
112
83
  name: rubocop
113
84
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +115,7 @@ executables: []
144
115
  extensions: []
145
116
  extra_rdoc_files: []
146
117
  files:
147
- - MIT-LICENSE
118
+ - LICENSE
148
119
  - README.md
149
120
  - Rakefile
150
121
  - lib/next_page.rb
@@ -157,7 +128,6 @@ homepage: https://github.com/RockSolt/next_page
157
128
  licenses:
158
129
  - MIT
159
130
  metadata: {}
160
- post_install_message:
161
131
  rdoc_options: []
162
132
  require_paths:
163
133
  - lib
@@ -165,15 +135,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
135
  requirements:
166
136
  - - ">="
167
137
  - !ruby/object:Gem::Version
168
- version: 3.1.0
138
+ version: '3.2'
169
139
  required_rubygems_version: !ruby/object:Gem::Requirement
170
140
  requirements:
171
141
  - - ">="
172
142
  - !ruby/object:Gem::Version
173
143
  version: '0'
174
144
  requirements: []
175
- rubygems_version: 3.5.7
176
- signing_key:
145
+ rubygems_version: 4.0.3
177
146
  specification_version: 4
178
147
  summary: Pagination for Rails Controllers
179
148
  test_files: []
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2020 Todd Kummer
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.