order_query 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +10 -1
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/order_query/space.rb +11 -2
- data/lib/order_query/version.rb +1 -1
- data/spec/gemfiles/rails_7_0.gemfile +21 -0
- data/spec/gemfiles/rails_7_1.gemfile +16 -0
- data/spec/order_query_spec.rb +6 -0
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 125cda1fd95cea909dd7a5084b7056e92f729166b4a1adec455c7846252411e0
|
4
|
+
data.tar.gz: 62b849461ea574c14092a01973433a71af41b49b6668207c141fd7a8cfdf3ca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e706dd852be3f01eb357e36c5cc4545af00d48cf88c90215bfb1de1bcc5175eefb181d50467f2d3216aed6416b7da4551c92394ac68faa6eb1ec0ff045570997
|
7
|
+
data.tar.gz: fc63180bd9ab0333db25f98e6216d6d22df0fff7f9954fec09e0e1951fa3751cc2d9ce59dba35e2bb08e497c44c87f79ff754d9085a55c8db52404705957a2a4
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.5.3
|
2
|
+
|
3
|
+
* Rails 7.1 now supported.
|
4
|
+
|
5
|
+
## 0.5.2
|
6
|
+
|
7
|
+
* Ruby 3.0 now supported.
|
8
|
+
* Rails 7.0 now supported.
|
9
|
+
|
1
10
|
## 0.5.1
|
2
11
|
|
3
12
|
* Rails 6.1 now supported.
|
@@ -23,7 +32,7 @@
|
|
23
32
|
|
24
33
|
## 0.3.4
|
25
34
|
|
26
|
-
* The `before` and `after` methods now accept a boolean argument that indicates
|
35
|
+
* The `before` and `after` methods now accept a boolean argument that indicates
|
27
36
|
whether the relation should exclude the given point or not.
|
28
37
|
By default the given point is excluded, if you want to include it,
|
29
38
|
use `before(false)` / `after(false)`.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/order_query/space.rb
CHANGED
@@ -14,8 +14,9 @@ module OrderQuery
|
|
14
14
|
# @see Column#initialize for the order_spec element format.
|
15
15
|
def initialize(base_scope, order_spec)
|
16
16
|
@base_scope = base_scope
|
17
|
-
@columns = order_spec.map
|
18
|
-
|
17
|
+
@columns = order_spec.map(&:clone)
|
18
|
+
@columns.map! do |cond_spec|
|
19
|
+
build_column(base_scope, cond_spec)
|
19
20
|
end
|
20
21
|
# add primary key if columns are not unique
|
21
22
|
unless @columns.last.unique?
|
@@ -58,5 +59,13 @@ module OrderQuery
|
|
58
59
|
"#<OrderQuery::Space @columns=#{@columns.inspect} "\
|
59
60
|
"@base_scope=#{@base_scope.inspect}>"
|
60
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def build_column(base_scope, cond_spec)
|
66
|
+
column_spec = cond_spec.last.is_a?(Hash) ? cond_spec : cond_spec.push({})
|
67
|
+
attr_name, *vals_and_or_dir, options = column_spec
|
68
|
+
Column.new(base_scope, attr_name, *vals_and_or_dir, **options)
|
69
|
+
end
|
61
70
|
end
|
62
71
|
end
|
data/lib/order_query/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gemspec path: '../../'
|
6
|
+
|
7
|
+
gem 'activerecord', '~> 7.0.0'
|
8
|
+
gem 'activesupport', '~> 7.0.0'
|
9
|
+
|
10
|
+
platforms :mri, :rbx do
|
11
|
+
# https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L13
|
12
|
+
gem 'sqlite3', '~> 1.4'
|
13
|
+
|
14
|
+
# https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L4
|
15
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
16
|
+
|
17
|
+
# https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6
|
18
|
+
gem 'mysql2', '>= 0.4.4'
|
19
|
+
end
|
20
|
+
|
21
|
+
eval_gemfile '../../shared.gemfile'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gemspec path: '../../'
|
6
|
+
|
7
|
+
gem 'activerecord', '~> 7.1.0'
|
8
|
+
gem 'activesupport', '~> 7.1.0'
|
9
|
+
|
10
|
+
platforms :mri, :rbx do
|
11
|
+
gem 'sqlite3', '~> 1.4'
|
12
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
13
|
+
gem 'mysql2', '>= 0.4.4'
|
14
|
+
end
|
15
|
+
|
16
|
+
eval_gemfile '../../shared.gemfile'
|
data/spec/order_query_spec.rb
CHANGED
@@ -169,6 +169,12 @@ RSpec.describe 'OrderQuery' do
|
|
169
169
|
)
|
170
170
|
end
|
171
171
|
|
172
|
+
it '.seek does not mutate the given order arguments' do
|
173
|
+
order = [[:priority, :desc], [:id, :asc]]
|
174
|
+
Issue.seek(order)
|
175
|
+
expect(order).to eq [[:priority, :desc], [:id, :asc]]
|
176
|
+
end
|
177
|
+
|
172
178
|
context 'partitioned on a boolean flag' do
|
173
179
|
before do
|
174
180
|
create_issue(active: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: order_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Mazovetskiy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '7.
|
22
|
+
version: '7.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '7.
|
32
|
+
version: '7.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '5.0'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '7.
|
42
|
+
version: '7.2'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '5.0'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '7.
|
52
|
+
version: '7.2'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +119,8 @@ files:
|
|
119
119
|
- spec/gemfiles/rails_5_2.gemfile
|
120
120
|
- spec/gemfiles/rails_6_0.gemfile
|
121
121
|
- spec/gemfiles/rails_6_1.gemfile
|
122
|
+
- spec/gemfiles/rails_7_0.gemfile
|
123
|
+
- spec/gemfiles/rails_7_1.gemfile
|
122
124
|
- spec/gemfiles/rubocop.gemfile
|
123
125
|
- spec/order_query_spec.rb
|
124
126
|
- spec/spec_helper.rb
|
@@ -128,7 +130,7 @@ licenses:
|
|
128
130
|
- MIT
|
129
131
|
metadata:
|
130
132
|
issue_tracker: https://github.com/glebm/order_query
|
131
|
-
post_install_message:
|
133
|
+
post_install_message:
|
132
134
|
rdoc_options: []
|
133
135
|
require_paths:
|
134
136
|
- lib
|
@@ -143,17 +145,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
145
|
- !ruby/object:Gem::Version
|
144
146
|
version: '0'
|
145
147
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
148
|
+
rubygems_version: 3.2.3
|
149
|
+
signing_key:
|
148
150
|
specification_version: 4
|
149
151
|
summary: Find next / previous Active Record(s) in one query
|
150
152
|
test_files:
|
151
|
-
- spec/spec_helper.rb
|
152
|
-
- spec/order_query_spec.rb
|
153
|
-
- spec/gemfiles/rails_6_1.gemfile
|
154
|
-
- spec/gemfiles/rails_5_2.gemfile
|
155
|
-
- spec/gemfiles/rails_6_0.gemfile
|
156
153
|
- spec/gemfiles/rails_5_0.gemfile
|
157
154
|
- spec/gemfiles/rails_5_1.gemfile
|
155
|
+
- spec/gemfiles/rails_5_2.gemfile
|
156
|
+
- spec/gemfiles/rails_6_0.gemfile
|
157
|
+
- spec/gemfiles/rails_6_1.gemfile
|
158
|
+
- spec/gemfiles/rails_7_0.gemfile
|
159
|
+
- spec/gemfiles/rails_7_1.gemfile
|
158
160
|
- spec/gemfiles/rubocop.gemfile
|
161
|
+
- spec/order_query_spec.rb
|
162
|
+
- spec/spec_helper.rb
|
159
163
|
- spec/support/order_expectation.rb
|