pagy_cursor 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +110 -111
- data/gemfiles/active_record_60.gemfile +1 -1
- data/gemfiles/active_record_61.gemfile +11 -0
- data/lib/pagy_cursor/pagy/extras/cursor.rb +5 -4
- data/lib/pagy_cursor/pagy/extras/uuid_cursor.rb +4 -3
- data/lib/pagy_cursor/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44004bd3c0d4a31c61ce024c96e7e69a064c49342aed3e24154a42b61431f0b2
|
4
|
+
data.tar.gz: 15bee98c168a66fb9fa7db1312e73d4ee5e8123c599d2106b51b3b18a380a367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58f4f60789e0558c92a060b13cc118cc5696097a34b9b14613bbd526030de18b2aa6b133967262b96c8b45de1ff9b2db04dae786d35ac934075f9d6b5d233307
|
7
|
+
data.tar.gz: e41e82f58a98e13e83173788dc402cc51df263b5d0ac9bf53cb1c22eef9f1dca97904afe8bd653502edabc874717c8dc9eade484de4b16936cbd941ecdd05e12
|
data/.github/workflows/ci.yml
CHANGED
@@ -34,9 +34,12 @@ jobs:
|
|
34
34
|
- ruby-version: 2.7
|
35
35
|
env:
|
36
36
|
BUNDLE_GEMFILE: gemfiles/active_record_52.gemfile
|
37
|
-
- ruby-version:
|
37
|
+
- ruby-version: 2.7
|
38
38
|
env:
|
39
39
|
BUNDLE_GEMFILE: gemfiles/active_record_60.gemfile
|
40
|
+
- ruby-version: 3.0
|
41
|
+
env:
|
42
|
+
BUNDLE_GEMFILE: gemfiles/active_record_61.gemfile
|
40
43
|
|
41
44
|
fail-fast: false
|
42
45
|
env: ${{ matrix.env }}
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,163 +1,162 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pagy_cursor (0.2.
|
4
|
+
pagy_cursor (0.2.1)
|
5
5
|
activerecord (>= 5)
|
6
|
-
pagy
|
6
|
+
pagy (< 5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.
|
12
|
-
actionpack (= 6.
|
11
|
+
actioncable (6.1.4.4)
|
12
|
+
actionpack (= 6.1.4.4)
|
13
|
+
activesupport (= 6.1.4.4)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.
|
16
|
-
actionpack (= 6.
|
17
|
-
activejob (= 6.
|
18
|
-
activerecord (= 6.
|
19
|
-
activestorage (= 6.
|
20
|
-
activesupport (= 6.
|
16
|
+
actionmailbox (6.1.4.4)
|
17
|
+
actionpack (= 6.1.4.4)
|
18
|
+
activejob (= 6.1.4.4)
|
19
|
+
activerecord (= 6.1.4.4)
|
20
|
+
activestorage (= 6.1.4.4)
|
21
|
+
activesupport (= 6.1.4.4)
|
21
22
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.
|
23
|
-
actionpack (= 6.
|
24
|
-
actionview (= 6.
|
25
|
-
activejob (= 6.
|
23
|
+
actionmailer (6.1.4.4)
|
24
|
+
actionpack (= 6.1.4.4)
|
25
|
+
actionview (= 6.1.4.4)
|
26
|
+
activejob (= 6.1.4.4)
|
27
|
+
activesupport (= 6.1.4.4)
|
26
28
|
mail (~> 2.5, >= 2.5.4)
|
27
29
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.
|
29
|
-
actionview (= 6.
|
30
|
-
activesupport (= 6.
|
31
|
-
rack (~> 2.0, >= 2.0.
|
30
|
+
actionpack (6.1.4.4)
|
31
|
+
actionview (= 6.1.4.4)
|
32
|
+
activesupport (= 6.1.4.4)
|
33
|
+
rack (~> 2.0, >= 2.0.9)
|
32
34
|
rack-test (>= 0.6.3)
|
33
35
|
rails-dom-testing (~> 2.0)
|
34
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.
|
36
|
-
actionpack (= 6.
|
37
|
-
activerecord (= 6.
|
38
|
-
activestorage (= 6.
|
39
|
-
activesupport (= 6.
|
37
|
+
actiontext (6.1.4.4)
|
38
|
+
actionpack (= 6.1.4.4)
|
39
|
+
activerecord (= 6.1.4.4)
|
40
|
+
activestorage (= 6.1.4.4)
|
41
|
+
activesupport (= 6.1.4.4)
|
40
42
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.
|
42
|
-
activesupport (= 6.
|
43
|
+
actionview (6.1.4.4)
|
44
|
+
activesupport (= 6.1.4.4)
|
43
45
|
builder (~> 3.1)
|
44
46
|
erubi (~> 1.4)
|
45
47
|
rails-dom-testing (~> 2.0)
|
46
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.
|
48
|
-
activesupport (= 6.
|
49
|
+
activejob (6.1.4.4)
|
50
|
+
activesupport (= 6.1.4.4)
|
49
51
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.
|
51
|
-
activesupport (= 6.
|
52
|
-
activerecord (6.
|
53
|
-
activemodel (= 6.
|
54
|
-
activesupport (= 6.
|
55
|
-
activestorage (6.
|
56
|
-
actionpack (= 6.
|
57
|
-
activejob (= 6.
|
58
|
-
activerecord (= 6.
|
59
|
-
|
60
|
-
|
52
|
+
activemodel (6.1.4.4)
|
53
|
+
activesupport (= 6.1.4.4)
|
54
|
+
activerecord (6.1.4.4)
|
55
|
+
activemodel (= 6.1.4.4)
|
56
|
+
activesupport (= 6.1.4.4)
|
57
|
+
activestorage (6.1.4.4)
|
58
|
+
actionpack (= 6.1.4.4)
|
59
|
+
activejob (= 6.1.4.4)
|
60
|
+
activerecord (= 6.1.4.4)
|
61
|
+
activesupport (= 6.1.4.4)
|
62
|
+
marcel (~> 1.0.0)
|
63
|
+
mini_mime (>= 1.1.0)
|
64
|
+
activesupport (6.1.4.4)
|
61
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
-
i18n (>=
|
63
|
-
minitest (
|
64
|
-
tzinfo (~>
|
65
|
-
zeitwerk (~> 2.
|
66
|
+
i18n (>= 1.6, < 2)
|
67
|
+
minitest (>= 5.1)
|
68
|
+
tzinfo (~> 2.0)
|
69
|
+
zeitwerk (~> 2.3)
|
66
70
|
builder (3.2.4)
|
67
|
-
coderay (1.1.
|
68
|
-
concurrent-ruby (1.1.
|
71
|
+
coderay (1.1.3)
|
72
|
+
concurrent-ruby (1.1.9)
|
69
73
|
crass (1.0.6)
|
70
|
-
diff-lcs (1.
|
71
|
-
erubi (1.
|
72
|
-
globalid (0.
|
73
|
-
activesupport (>=
|
74
|
-
i18n (1.
|
74
|
+
diff-lcs (1.5.0)
|
75
|
+
erubi (1.10.0)
|
76
|
+
globalid (1.0.0)
|
77
|
+
activesupport (>= 5.0)
|
78
|
+
i18n (1.9.1)
|
75
79
|
concurrent-ruby (~> 1.0)
|
76
|
-
loofah (2.
|
80
|
+
loofah (2.13.0)
|
77
81
|
crass (~> 1.0.2)
|
78
82
|
nokogiri (>= 1.5.9)
|
79
83
|
mail (2.7.1)
|
80
84
|
mini_mime (>= 0.1.1)
|
81
|
-
marcel (0.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
mini_mime (1.0.2)
|
86
|
-
mini_portile2 (2.6.1)
|
87
|
-
minitest (5.14.0)
|
85
|
+
marcel (1.0.2)
|
86
|
+
method_source (1.0.0)
|
87
|
+
mini_mime (1.1.2)
|
88
|
+
minitest (5.15.0)
|
88
89
|
mysql2 (0.5.3)
|
89
|
-
nio4r (2.5.
|
90
|
-
nokogiri (1.12.5)
|
91
|
-
mini_portile2 (~> 2.6.1)
|
90
|
+
nio4r (2.5.8)
|
91
|
+
nokogiri (1.12.5-x86_64-darwin)
|
92
92
|
racc (~> 1.4)
|
93
|
-
pagy (
|
94
|
-
pg (1.
|
95
|
-
pry (0.
|
96
|
-
coderay (~> 1.1
|
97
|
-
method_source (~>
|
98
|
-
racc (1.
|
93
|
+
pagy (4.11.0)
|
94
|
+
pg (1.3.1)
|
95
|
+
pry (0.14.1)
|
96
|
+
coderay (~> 1.1)
|
97
|
+
method_source (~> 1.0)
|
98
|
+
racc (1.6.0)
|
99
99
|
rack (2.2.3)
|
100
100
|
rack-test (1.1.0)
|
101
101
|
rack (>= 1.0, < 3)
|
102
|
-
rails (6.
|
103
|
-
actioncable (= 6.
|
104
|
-
actionmailbox (= 6.
|
105
|
-
actionmailer (= 6.
|
106
|
-
actionpack (= 6.
|
107
|
-
actiontext (= 6.
|
108
|
-
actionview (= 6.
|
109
|
-
activejob (= 6.
|
110
|
-
activemodel (= 6.
|
111
|
-
activerecord (= 6.
|
112
|
-
activestorage (= 6.
|
113
|
-
activesupport (= 6.
|
114
|
-
bundler (>= 1.
|
115
|
-
railties (= 6.
|
102
|
+
rails (6.1.4.4)
|
103
|
+
actioncable (= 6.1.4.4)
|
104
|
+
actionmailbox (= 6.1.4.4)
|
105
|
+
actionmailer (= 6.1.4.4)
|
106
|
+
actionpack (= 6.1.4.4)
|
107
|
+
actiontext (= 6.1.4.4)
|
108
|
+
actionview (= 6.1.4.4)
|
109
|
+
activejob (= 6.1.4.4)
|
110
|
+
activemodel (= 6.1.4.4)
|
111
|
+
activerecord (= 6.1.4.4)
|
112
|
+
activestorage (= 6.1.4.4)
|
113
|
+
activesupport (= 6.1.4.4)
|
114
|
+
bundler (>= 1.15.0)
|
115
|
+
railties (= 6.1.4.4)
|
116
116
|
sprockets-rails (>= 2.0.0)
|
117
117
|
rails-dom-testing (2.0.3)
|
118
118
|
activesupport (>= 4.2.0)
|
119
119
|
nokogiri (>= 1.6)
|
120
|
-
rails-html-sanitizer (1.
|
120
|
+
rails-html-sanitizer (1.4.2)
|
121
121
|
loofah (~> 2.3)
|
122
|
-
railties (6.
|
123
|
-
actionpack (= 6.
|
124
|
-
activesupport (= 6.
|
122
|
+
railties (6.1.4.4)
|
123
|
+
actionpack (= 6.1.4.4)
|
124
|
+
activesupport (= 6.1.4.4)
|
125
125
|
method_source
|
126
|
-
rake (>= 0.
|
127
|
-
thor (
|
128
|
-
rake (13.0.
|
129
|
-
rspec (3.
|
130
|
-
rspec-core (~> 3.
|
131
|
-
rspec-expectations (~> 3.
|
132
|
-
rspec-mocks (~> 3.
|
133
|
-
rspec-core (3.
|
134
|
-
rspec-support (~> 3.
|
135
|
-
rspec-expectations (3.
|
126
|
+
rake (>= 0.13)
|
127
|
+
thor (~> 1.0)
|
128
|
+
rake (13.0.6)
|
129
|
+
rspec (3.10.0)
|
130
|
+
rspec-core (~> 3.10.0)
|
131
|
+
rspec-expectations (~> 3.10.0)
|
132
|
+
rspec-mocks (~> 3.10.0)
|
133
|
+
rspec-core (3.10.2)
|
134
|
+
rspec-support (~> 3.10.0)
|
135
|
+
rspec-expectations (3.10.2)
|
136
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
-
rspec-support (~> 3.
|
138
|
-
rspec-mocks (3.
|
137
|
+
rspec-support (~> 3.10.0)
|
138
|
+
rspec-mocks (3.10.3)
|
139
139
|
diff-lcs (>= 1.2.0, < 2.0)
|
140
|
-
rspec-support (~> 3.
|
141
|
-
rspec-support (3.
|
142
|
-
sprockets (4.0.
|
140
|
+
rspec-support (~> 3.10.0)
|
141
|
+
rspec-support (3.10.3)
|
142
|
+
sprockets (4.0.2)
|
143
143
|
concurrent-ruby (~> 1.0)
|
144
144
|
rack (> 1, < 3)
|
145
|
-
sprockets-rails (3.2
|
146
|
-
actionpack (>=
|
147
|
-
activesupport (>=
|
145
|
+
sprockets-rails (3.4.2)
|
146
|
+
actionpack (>= 5.2)
|
147
|
+
activesupport (>= 5.2)
|
148
148
|
sprockets (>= 3.0.0)
|
149
149
|
sqlite3 (1.4.2)
|
150
|
-
thor (1.
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
websocket-driver (0.7.1)
|
150
|
+
thor (1.2.1)
|
151
|
+
tzinfo (2.0.4)
|
152
|
+
concurrent-ruby (~> 1.0)
|
153
|
+
websocket-driver (0.7.5)
|
155
154
|
websocket-extensions (>= 0.1.0)
|
156
155
|
websocket-extensions (0.1.5)
|
157
|
-
zeitwerk (2.
|
156
|
+
zeitwerk (2.5.4)
|
158
157
|
|
159
158
|
PLATFORMS
|
160
|
-
|
159
|
+
x86_64-darwin-19
|
161
160
|
|
162
161
|
DEPENDENCIES
|
163
162
|
bundler (~> 2.0)
|
@@ -165,10 +164,10 @@ DEPENDENCIES
|
|
165
164
|
pagy_cursor!
|
166
165
|
pg
|
167
166
|
pry
|
168
|
-
rails (~> 6.
|
167
|
+
rails (~> 6.1)
|
169
168
|
rake (~> 13.0)
|
170
169
|
rspec (~> 3.0)
|
171
170
|
sqlite3
|
172
171
|
|
173
172
|
BUNDLED WITH
|
174
|
-
2.
|
173
|
+
2.2.30
|
@@ -0,0 +1,11 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
gem "rails", "~> 6.1"
|
6
|
+
gem "pg"
|
7
|
+
gem "sqlite3"
|
8
|
+
gem "mysql2"
|
9
|
+
gem "pry"
|
10
|
+
# Specify your gem's dependencies in pagy_cursor.gemspec
|
11
|
+
gemspec path: "../"
|
@@ -10,7 +10,7 @@ class Pagy
|
|
10
10
|
items = pagy_cursor_get_items(collection, pagy, pagy.position)
|
11
11
|
pagy.has_more = pagy_cursor_has_more?(items, pagy)
|
12
12
|
|
13
|
-
return pagy, items
|
13
|
+
return pagy, items
|
14
14
|
end
|
15
15
|
|
16
16
|
def pagy_cursor_get_vars(collection, vars)
|
@@ -23,16 +23,17 @@ class Pagy
|
|
23
23
|
def pagy_cursor_get_items(collection, pagy, position=nil)
|
24
24
|
if position.present?
|
25
25
|
sql_comparation = pagy.arel_table[pagy.primary_key].send(pagy.comparation, position)
|
26
|
-
collection.where(sql_comparation).reorder(pagy.order).limit(pagy.items
|
26
|
+
collection.where(sql_comparation).reorder(pagy.order).limit(pagy.items)
|
27
27
|
else
|
28
|
-
collection.reorder(pagy.order).limit(pagy.items
|
28
|
+
collection.reorder(pagy.order).limit(pagy.items)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
def pagy_cursor_has_more?(collection, pagy)
|
33
33
|
return false if collection.empty?
|
34
34
|
|
35
|
-
collection.
|
35
|
+
next_position = collection.last[pagy.primary_key]
|
36
|
+
pagy_cursor_get_items(collection, pagy, next_position).exists?
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
@@ -9,7 +9,7 @@ class Pagy
|
|
9
9
|
items = pagy_uuid_cursor_get_items(collection, pagy, pagy.position)
|
10
10
|
pagy.has_more = pagy_uuid_cursor_has_more?(items, pagy)
|
11
11
|
|
12
|
-
return pagy, items
|
12
|
+
return pagy, items
|
13
13
|
end
|
14
14
|
|
15
15
|
def pagy_uuid_cursor_get_vars(collection, vars)
|
@@ -29,13 +29,14 @@ class Pagy
|
|
29
29
|
|
30
30
|
collection = collection.where(sql_comparation)
|
31
31
|
end
|
32
|
-
collection.reorder(pagy.order).limit(pagy.items
|
32
|
+
collection.reorder(pagy.order).limit(pagy.items)
|
33
33
|
end
|
34
34
|
|
35
35
|
def pagy_uuid_cursor_has_more?(collection, pagy)
|
36
36
|
return false if collection.empty?
|
37
37
|
|
38
|
-
collection.
|
38
|
+
next_position = collection.last[pagy.primary_key]
|
39
|
+
pagy_uuid_cursor_get_items(collection, pagy, next_position).exists?
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
data/lib/pagy_cursor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy_cursor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uysim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pagy
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- gemfiles/active_record_51.gemfile
|
104
104
|
- gemfiles/active_record_52.gemfile
|
105
105
|
- gemfiles/active_record_60.gemfile
|
106
|
+
- gemfiles/active_record_61.gemfile
|
106
107
|
- lib/pagy_cursor.rb
|
107
108
|
- lib/pagy_cursor/pagy/cursor.rb
|
108
109
|
- lib/pagy_cursor/pagy/extras/cursor.rb
|
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
- !ruby/object:Gem::Version
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
|
-
rubygems_version: 3.2.
|
132
|
+
rubygems_version: 3.2.32
|
132
133
|
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: cursor paginations for pagy
|