arel_extensions 1.5.1 → 1.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: 4782dabe4923d8936216aff9889a846f3dc83e5c4404cf0282799d70326b5da0
4
- data.tar.gz: fb02053b169f2fd2cac3a15b8bc8bab24d9d9c9f6da085e4a97e3af94696b050
3
+ metadata.gz: aa4f854a32266aeaef27f214b3bbb6ee7c1af78fe29aab1038a0bab9efd263a2
4
+ data.tar.gz: 22ae69a84925c2fc30a3036ea5e737aa36e5b3bc80099449ae806d62c5789cd4
5
5
  SHA512:
6
- metadata.gz: 32a490287b7018a829d226328a2051a681027c6c16152400038c70a58c145531a5400a72f0c505f34607b8c7d93ce8590340948c1e91f5512f67c1c5e3b12f93
7
- data.tar.gz: 5d8376ea039e7a6c3b062b8e224a12d225bff6777474fe5d1140ff35ecebcc5b7684727de64ff89ee4b70515e0a1e529c3564f8a161875c411bf7ab85df8023b
6
+ metadata.gz: 6f4e4c8ff1d568f917d6d731d5498e5c86e26d0f3f2908911a4f564cb0c5b201f3ce29eb9189316c96c5d8982b5ead4a6b456e9a796ffa38c4bb31d56c9481b4
7
+ data.tar.gz: 6974d4a2fb0648462b4aedcb1dc3639186a3cbbe58e3440cd8cfa80459ab7d073983ae317bec7491ba0b76674765abfa9b2aa900ab03c20911363328f644da0b
@@ -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,11 @@
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
+
5
10
  ## Release v2.3.1/v1.5.1 (20-12-2024)
6
11
 
7
12
  - Fallback to Ruby's Warning module if ActiveSupport doesn't exist. Relevant for old Rails versions.
@@ -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 = '1.5.1'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
@@ -33,7 +33,7 @@ module ArelExtensions
33
33
  module Warning
34
34
  def deprecated msg, what: nil
35
35
  kaller = caller(2..2).first
36
- 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'
37
37
 
38
38
  what = caller_locations(1, 1).first.label if what.nil?
39
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.1'.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.1'.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: 1.5.1
4
+ version: 1.5.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-20 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: arel
@@ -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: []