order_query 0.5.1 → 0.5.2

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: 6b0284712fbd8e451e7bb4f41a81dc410c8141bc6e3d670dae192e02565bfb9f
4
- data.tar.gz: 6b76ba2002e94c9f320f124ac4ba12bf786e213f9f7fcbcae20ae47402054dce
3
+ metadata.gz: 2f9e31c687e96f7014255acbfa4590f9495bca00b942d23c111f38a6c77646eb
4
+ data.tar.gz: ae44f4ca9d520edd2e2d3dc7eead83e9de2f8e440fa2c4ad1d9ce59f266f2756
5
5
  SHA512:
6
- metadata.gz: ddae4f82c3df302d84d2a7402aa5cc0aa2e6b4706a6d104b296ab5a33d036a121839fd01f42291364cc83347cc63e4a25e6776cbf776cf7e9c3e307818919f79
7
- data.tar.gz: c1887c00922ab788bf659111e8ac55f7843c7a6dadfdf2d7948ca5ca1dd08a272142658e735c276d1b54c02b2fefb1d8fda1ebe49498d54cd76bc35435bda12a
6
+ metadata.gz: d570f7f7133f1475c109be472d61014b31ed0569eb77474de0658eaf6ca77053d411c9f434971a35250a703c6455041aa7d483ddd68439df727a03026ddfd263
7
+ data.tar.gz: ba16dd0f9c83246ac4f3e10d8492a30063ca12170b1619f971486ad802f1ec548d368c59c59c06befe344d4b71eb35b6feee64564fcee99e76c6e2f904d5d22f
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.5.2
2
+
3
+ * Ruby 3.0 now supported.
4
+ * Rails 7.0 now supported.
5
+
1
6
  ## 0.5.1
2
7
 
3
8
  * Rails 6.1 now supported.
@@ -23,7 +28,7 @@
23
28
 
24
29
  ## 0.3.4
25
30
 
26
- * The `before` and `after` methods now accept a boolean argument that indicates
31
+ * The `before` and `after` methods now accept a boolean argument that indicates
27
32
  whether the relation should exclude the given point or not.
28
33
  By default the given point is excluded, if you want to include it,
29
34
  use `before(false)` / `after(false)`.
data/Gemfile CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- eval_gemfile 'spec/gemfiles/rails_6_1.gemfile'
5
+ eval_gemfile 'spec/gemfiles/rails_7_0.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.1'
14
+ gem 'order_query', '~> 0.5.2'
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -15,7 +15,7 @@ module OrderQuery
15
15
  def initialize(base_scope, order_spec)
16
16
  @base_scope = base_scope
17
17
  @columns = order_spec.map do |cond_spec|
18
- Column.new(base_scope, *cond_spec)
18
+ build_column(base_scope, cond_spec)
19
19
  end
20
20
  # add primary key if columns are not unique
21
21
  unless @columns.last.unique?
@@ -58,5 +58,13 @@ module OrderQuery
58
58
  "#<OrderQuery::Space @columns=#{@columns.inspect} "\
59
59
  "@base_scope=#{@base_scope.inspect}>"
60
60
  end
61
+
62
+ private
63
+
64
+ def build_column(base_scope, cond_spec)
65
+ column_spec = cond_spec.last.is_a?(Hash) ? cond_spec : cond_spec.push({})
66
+ attr_name, *vals_and_or_dir, options = column_spec
67
+ Column.new(base_scope, attr_name, *vals_and_or_dir, **options)
68
+ end
61
69
  end
62
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OrderQuery
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  end
@@ -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'
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.1
4
+ version: 0.5.2
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: 2021-02-25 00:00:00.000000000 Z
11
+ date: 2021-12-16 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.0'
22
+ version: '7.1'
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.0'
32
+ version: '7.1'
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.0'
42
+ version: '7.1'
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.0'
52
+ version: '7.1'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rake
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +119,7 @@ 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
122
123
  - spec/gemfiles/rubocop.gemfile
123
124
  - spec/order_query_spec.rb
124
125
  - spec/spec_helper.rb
@@ -128,7 +129,7 @@ licenses:
128
129
  - MIT
129
130
  metadata:
130
131
  issue_tracker: https://github.com/glebm/order_query
131
- post_install_message:
132
+ post_install_message:
132
133
  rdoc_options: []
133
134
  require_paths:
134
135
  - lib
@@ -143,17 +144,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  - !ruby/object:Gem::Version
144
145
  version: '0'
145
146
  requirements: []
146
- rubygems_version: 3.1.2
147
- signing_key:
147
+ rubygems_version: 3.2.3
148
+ signing_key:
148
149
  specification_version: 4
149
150
  summary: Find next / previous Active Record(s) in one query
150
151
  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
152
  - spec/gemfiles/rails_5_0.gemfile
157
153
  - spec/gemfiles/rails_5_1.gemfile
154
+ - spec/gemfiles/rails_5_2.gemfile
155
+ - spec/gemfiles/rails_6_0.gemfile
156
+ - spec/gemfiles/rails_6_1.gemfile
157
+ - spec/gemfiles/rails_7_0.gemfile
158
158
  - spec/gemfiles/rubocop.gemfile
159
+ - spec/order_query_spec.rb
160
+ - spec/spec_helper.rb
159
161
  - spec/support/order_expectation.rb