order_query 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f9e31c687e96f7014255acbfa4590f9495bca00b942d23c111f38a6c77646eb
4
- data.tar.gz: ae44f4ca9d520edd2e2d3dc7eead83e9de2f8e440fa2c4ad1d9ce59f266f2756
3
+ metadata.gz: ccb1ca41f1a9ccf9a8eb6d620b20423e3ebfd710c9a5b2023dfd46d8b2d0b6f9
4
+ data.tar.gz: 6c38c541e8d9f886aad5409cd546b06affc7e4745b80b942483805ffc0705488
5
5
  SHA512:
6
- metadata.gz: d570f7f7133f1475c109be472d61014b31ed0569eb77474de0658eaf6ca77053d411c9f434971a35250a703c6455041aa7d483ddd68439df727a03026ddfd263
7
- data.tar.gz: ba16dd0f9c83246ac4f3e10d8492a30063ca12170b1619f971486ad802f1ec548d368c59c59c06befe344d4b71eb35b6feee64564fcee99e76c6e2f904d5d22f
6
+ metadata.gz: 7b136317b771ccb0e879d6f27022480682e6128ef927f3713e7094f4fe22c341ff1cbac649cc482f412eea4253d4929c1d7eaaf04b8eff01e670e6e1b5022323
7
+ data.tar.gz: c49e190ba1de6ea9aa5c23e6622ec28b1ad909876a1106d776f39293227cebe8477e4199073e37e67b91f328c2e7f2e81987284970665f9fb53e62e5af6aadeb
data/CHANGES.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.5.4
2
+
3
+ * Rails 7.2 now supported
4
+
5
+ ## 0.5.3
6
+
7
+ * Rails 7.1 now supported.
8
+
1
9
  ## 0.5.2
2
10
 
3
11
  * Ruby 3.0 now supported.
data/Gemfile CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- eval_gemfile 'spec/gemfiles/rails_7_0.gemfile'
5
+ eval_gemfile 'spec/gemfiles/rails_7_2.gemfile'
6
6
  eval_gemfile 'rubocop.gemfile'
data/README.md CHANGED
@@ -11,7 +11,7 @@ This gem finds the next or previous record(s) relative to the current one effici
11
11
  Add to Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'order_query', '~> 0.5.2'
14
+ gem 'order_query', '~> 0.5.4'
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -68,14 +68,14 @@ module OrderQuery
68
68
  v = record.send(column.name)
69
69
  if v.nil? && !column.nullable?
70
70
  fail Errors::NonNullableColumnIsNullError,
71
- "Column #{column.inspect} is NULL on record #{@record.inspect}. "\
71
+ "Column #{column.inspect} is NULL on record #{@record.send(inspect_method)}. "\
72
72
  'Set the `nulls` option to :first or :last.'
73
73
  end
74
74
  v
75
75
  end
76
76
 
77
77
  def inspect
78
- "#<OrderQuery::Point @record=#{@record.inspect} @space=#{@space.inspect}>"
78
+ "#<OrderQuery::Point @record=#{@record.send(inspect_method)} @space=#{@space.inspect}>"
79
79
  end
80
80
 
81
81
  protected
@@ -85,5 +85,11 @@ module OrderQuery
85
85
  def unless_record_eq(rec)
86
86
  rec unless rec == @record
87
87
  end
88
+
89
+ private
90
+ def inspect_method
91
+ Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("7.2.0") ? :full_inspect
92
+ : :inspect
93
+ end
88
94
  end
89
95
  end
@@ -14,7 +14,8 @@ 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 do |cond_spec|
17
+ @columns = order_spec.map(&:clone)
18
+ @columns.map! do |cond_spec|
18
19
  build_column(base_scope, cond_spec)
19
20
  end
20
21
  # add primary key if columns are not unique
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OrderQuery
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.4'
5
5
  end
@@ -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'
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec path: '../../'
6
+
7
+ gem 'activerecord', '~> 7.2.0'
8
+ gem 'activesupport', '~> 7.2.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'
@@ -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.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Mazovetskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-16 00:00:00.000000000 Z
11
+ date: 2024-11-15 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.1'
22
+ version: '7.3'
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.1'
32
+ version: '7.3'
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.1'
42
+ version: '7.3'
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.1'
52
+ version: '7.3'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rake
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -120,6 +120,8 @@ files:
120
120
  - spec/gemfiles/rails_6_0.gemfile
121
121
  - spec/gemfiles/rails_6_1.gemfile
122
122
  - spec/gemfiles/rails_7_0.gemfile
123
+ - spec/gemfiles/rails_7_1.gemfile
124
+ - spec/gemfiles/rails_7_2.gemfile
123
125
  - spec/gemfiles/rubocop.gemfile
124
126
  - spec/order_query_spec.rb
125
127
  - spec/spec_helper.rb
@@ -144,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
146
  - !ruby/object:Gem::Version
145
147
  version: '0'
146
148
  requirements: []
147
- rubygems_version: 3.2.3
149
+ rubygems_version: 3.5.3
148
150
  signing_key:
149
151
  specification_version: 4
150
152
  summary: Find next / previous Active Record(s) in one query
@@ -155,6 +157,8 @@ test_files:
155
157
  - spec/gemfiles/rails_6_0.gemfile
156
158
  - spec/gemfiles/rails_6_1.gemfile
157
159
  - spec/gemfiles/rails_7_0.gemfile
160
+ - spec/gemfiles/rails_7_1.gemfile
161
+ - spec/gemfiles/rails_7_2.gemfile
158
162
  - spec/gemfiles/rubocop.gemfile
159
163
  - spec/order_query_spec.rb
160
164
  - spec/spec_helper.rb