arel_extensions 2.3.0 → 2.3.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: bec346d9bbce78a1d91d023e0291903cb1c61b115237681cb4d9b4174e5f370a
4
- data.tar.gz: b2e307f12bdb154129d29179093a04e1c7cd632feb2ed4d5e706a97acbfd0526
3
+ metadata.gz: 897fdf4d5248e3a7d67d5c99bdea4341e0f3d29f756d712bb982577adc438671
4
+ data.tar.gz: 5066e14f35d9f820e413ed8cbb994fd8870966b9b086536c57e71a0718a60033
5
5
  SHA512:
6
- metadata.gz: 90fc4233e4699e6a7da8d7141351f21d1d33d72d9f3220a2b47f5f9e425bca147be2db7a1f062696b17b593cb5191bf5fe75be2f68022139c4e7fce6021a43a9
7
- data.tar.gz: 5c49180d1bb19d6ad2338a509811010c0749bcb6beda93c9d1d8e68c46f4316bd9bf3cc22768695bf790c2d4f6ddd68d7378819dbf10ad38823cf55030c3aff9
6
+ metadata.gz: 7cc535755cbe7274d118a8b4ab68321082664be5c8714e44f546c71f16ebe083a54acd816c720b5d3e8dde4272c649565b544e94072e5d9de50be1625f26888f
7
+ data.tar.gz: d8d578ed26702eb285fe2e36cd4b9166187ed3486eccd09901b9f599750d0e45a6100e09394fdb1181e2c64c3446ef00dae89b2ef18d1dba17321b17a0b0b39b
@@ -2,6 +2,10 @@ name: Build and Test
2
2
 
3
3
  # Ruby + Rails Compatibility Matrix from here:
4
4
  # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
5
+ #
6
+ # Images are fixed to ubuntu 22.04 because jruby-9.2 is unavailable in
7
+ # ubuntu-24.04 (ubuntu-latest when I tested). Also, for rails < 6, sqlite3
8
+ # will not build because libsqlite3-dev is missing.
5
9
 
6
10
  on:
7
11
  push:
@@ -14,7 +18,7 @@ on:
14
18
  jobs:
15
19
  job_test_to_sql:
16
20
  name: test to_sql
17
- runs-on: ubuntu-latest
21
+ runs-on: ubuntu-22.04
18
22
  strategy:
19
23
  fail-fast: false
20
24
  matrix:
@@ -78,7 +82,7 @@ jobs:
78
82
 
79
83
  job_test_sqlite:
80
84
  name: test sqlite
81
- runs-on: ubuntu-latest
85
+ runs-on: ubuntu-22.04
82
86
  strategy:
83
87
  fail-fast: false
84
88
  matrix:
@@ -143,7 +147,7 @@ jobs:
143
147
 
144
148
  job_test_postgres:
145
149
  name: test postgres
146
- runs-on: ubuntu-latest
150
+ runs-on: ubuntu-22.04
147
151
  strategy:
148
152
  fail-fast: false
149
153
  matrix:
@@ -232,7 +236,7 @@ jobs:
232
236
 
233
237
  job_test_mysql:
234
238
  name: test mysql
235
- runs-on: ubuntu-latest
239
+ runs-on: ubuntu-22.04
236
240
  strategy:
237
241
  fail-fast: false
238
242
  matrix:
@@ -316,7 +320,7 @@ jobs:
316
320
 
317
321
  job_test_mssql:
318
322
  name: test mssql on linux
319
- runs-on: ubuntu-latest
323
+ runs-on: ubuntu-22.04
320
324
  strategy:
321
325
  fail-fast: false
322
326
  matrix:
data/NEWS.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## [unreleased]
4
4
 
5
+ ## Release v2.3.2/v1.5.2 (02-01-2025)
6
+
7
+ - Fix a subtle bug on table access as in `table[:col]` in certain situations.
8
+ - `==` and `!=` deprecation warnings can stem from `arel` itself, so now we don't emit them because they're plain wrong.
9
+
10
+ ## Release v2.3.1/v1.5.1 (20-12-2024)
11
+
12
+ - Fallback to Ruby's Warning module if ActiveSupport doesn't exist. Relevant for old Rails versions.
13
+ - Added documentation on how to _"properly"_ configure the deprecator in a Rails application.
14
+
5
15
  ## Release v2.3.0/v1.5.0 (19-12-2024)
6
16
 
7
17
  - Use ActiveSupport's deprecation machinery instead of Ruby's Warning module.
@@ -47,14 +47,27 @@ module ArelExtensions
47
47
  ArelExtensions::Nodes::Substring.new [self, start, len]
48
48
  end
49
49
 
50
- def [](start, ind = nil)
51
- start += 1 if start.is_a?(Integer)
52
- if start.is_a?(Range)
50
+ # Return a [ArelExtensions::Nodes::Substring] if `start` is a [Range] or an
51
+ # [Integer].
52
+ #
53
+ # Return the result to `self.send(start)` if it's a [String|Symbol]. The
54
+ # assumption is that you're trying to reach an [Arel::Table]'s
55
+ # [Arel::Attribute].
56
+ #
57
+ # @note `ind` should be an [Integer|NilClass] if `start` is an [Integer].
58
+ # It's ignored in all other cases.
59
+ def [](start, end_ = nil)
60
+ if start.is_a?(String) || start.is_a?(Symbol)
61
+ self.send(start)
62
+ elsif start.is_a?(Range)
53
63
  ArelExtensions::Nodes::Substring.new [self, start.begin + 1, start.end - start.begin + 1]
54
- elsif start.is_a?(Integer) && !ind
55
- ArelExtensions::Nodes::Substring.new [self, start, 1]
64
+ elsif start.is_a?(Integer) && !end_
65
+ ArelExtensions::Nodes::Substring.new [self, start + 1, 1]
66
+ elsif start.is_a?(Integer)
67
+ start += 1
68
+ ArelExtensions::Nodes::Substring.new [self, start, end_ - start + 1]
56
69
  else
57
- ArelExtensions::Nodes::Substring.new [self, start, ind - start + 1]
70
+ raise ArgumentError, 'unrecognized argument types; can accept integers, ranges, or strings.'
58
71
  end
59
72
  end
60
73
 
@@ -1,3 +1,3 @@
1
1
  module ArelExtensions
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.3.2'.freeze
3
3
  end
@@ -1,12 +1,39 @@
1
1
  module ArelExtensions
2
+ class RubyDeprecator
3
+ if RUBY_VERSION.split('.')[0].to_i < 3
4
+ def warn msg
5
+ Kernel.warn(msg)
6
+ end
7
+ else
8
+ def warn msg
9
+ Kernel.warn(msg, category: :deprecated)
10
+ end
11
+ end
12
+ end
13
+
14
+ # To configure deprecations in a Rails application, you can do something
15
+ # like this:
16
+ #
17
+ # ```ruby
18
+ # ArelExtensions.deprecator.behavior =
19
+ # (Rails.application.config.active_support.deprecation || :stderr)
20
+ # ```
21
+ #
22
+ # See ActiveSupport's deprecation documentation for more details.
2
23
  def self.deprecator
3
- @deprecator ||= ActiveSupport::Deprecation.new(ArelExtensions::VERSION, "arel_extensions")
24
+ @deprecator ||=
25
+ if defined?(ActiveSupport::Deprecation)
26
+ major, minor = Gem::Version.create(ArelExtensions::VERSION).segments
27
+ ActiveSupport::Deprecation.new("#{major}.#{minor}", 'arel_extensions')
28
+ else
29
+ RubyDeprecator::new
30
+ end
4
31
  end
5
32
 
6
33
  module Warning
7
34
  def deprecated msg, what: nil
8
35
  kaller = caller(2..2).first
9
- return if kaller.include?('lib/arel_extensions') && ENV['AREL_EXTENSIONS_IN_TEST'] != '1'
36
+ return if /lib\/(:?arel(?:_extensions)?|active_record)\// =~ kaller && ENV['AREL_EXTENSIONS_IN_TEST'] != '1'
10
37
 
11
38
  what = caller_locations(1, 1).first.label if what.nil?
12
39
  ArelExtensions.deprecator.warn "#{kaller}: `#{what}` is now deprecated. #{msg}"
data/version_v1.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ArelExtensions
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
data/version_v2.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ArelExtensions
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arel_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yann Azoury
8
8
  - Félix Bellanger
9
9
  - Julien Delporte
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-12-19 00:00:00.000000000 Z
13
+ date: 2025-01-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -204,7 +204,7 @@ homepage: https://github.com/Faveod/arel-extensions
204
204
  licenses:
205
205
  - MIT
206
206
  metadata: {}
207
- post_install_message:
207
+ post_install_message:
208
208
  rdoc_options:
209
209
  - "--main"
210
210
  - README.md
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  requirements: []
224
224
  rubygems_version: 3.4.19
225
- signing_key:
225
+ signing_key:
226
226
  specification_version: 4
227
227
  summary: Extending Arel
228
228
  test_files: []