activerecord_dynamic_scope 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6eb64158792856027c2ea947644754e8fd7c32d162385208149c62fd0c87494e
4
- data.tar.gz: 3b635b095e6f35de9fbd58c581b958020fd9605a1cf2dee07e8065a34ab2c7bb
3
+ metadata.gz: 58669ddbcf6468bf56edc3324683ffe9750773e48bc17f1292046dcf4b666b32
4
+ data.tar.gz: 38dfde30cdd440f962bce2e39b5eb7590ae83678ba8494a0947d4061059bbd0c
5
5
  SHA512:
6
- metadata.gz: '0199ce1fe872c4ea92af29095175f2e74029f247437cbd31176905cf1ccd9fbc1e4f9553c3efa8a79a9833fefc448cd1405d1f03ca0c4c4a90ff43a1dc86f8ba'
7
- data.tar.gz: 7b846780182438e27a4ce9c6fae6ee6adecbcf5c456c1afdef6abc823efd3662318af7471d8c4ce020a346620cca1d882eca3bf21941225a631dc5f02ada7150
6
+ metadata.gz: 0a02b3153765f18b05fa3a230d692949b40c2b8738bfe72ef313c782658aa16faac3cb6b02056853fe09246dc244d96d2c7a6196585695ad14f40e4944c97ff9
7
+ data.tar.gz: 1b428d850a43542dd84e89e5f6ab5eb2b1ffd7cb0282be329c2ffcb08a57334e9fbe5c96b56c0ec12e71e43118cf289aab94bea8f1932650555b5b1306ecd74d
@@ -4,7 +4,7 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  test:
7
- runs-on: ubuntu-22.04
7
+ runs-on: ubuntu-24.04
8
8
  services:
9
9
  postgres:
10
10
  image: postgres:15
@@ -48,7 +48,7 @@ jobs:
48
48
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
49
49
 
50
50
  steps:
51
- - uses: actions/checkout@v4
51
+ - uses: actions/checkout@v7
52
52
  - uses: ruby/setup-ruby@v1
53
53
  with:
54
54
  ruby-version: ${{ matrix.ruby }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.2.0
4
+
5
+ * Add `with!` and `without!` for unsafe dynamic scope switching.
6
+ * Support both array and variadic arguments for `without` method.
7
+
3
8
  ## 1.1.0
4
9
 
5
10
  * Drop suupport for ruby <= 2.7, rails <= 6.1.
@@ -14,4 +14,8 @@ if RUBY_VERSION >= "3.4"
14
14
  gem "mutex_m"
15
15
  end
16
16
 
17
+ if RUBY_VERSION >= "4.0"
18
+ gem "tsort"
19
+ end
20
+
17
21
  gemspec path: "../"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordDynamicScope
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -22,12 +22,20 @@ module ActiveRecordDynamicScope
22
22
  Thread.current[KEY] = old
23
23
  end
24
24
 
25
- def without(keys)
25
+ def without(*keys)
26
26
  old = Thread.current[KEY]
27
- Thread.current[KEY] = Thread.current[KEY].to_h.except(keys)
27
+ Thread.current[KEY] = Thread.current[KEY].to_h.except(*keys.flatten)
28
28
  yield
29
29
  ensure
30
30
  Thread.current[KEY] = old
31
31
  end
32
+
33
+ def with!(hash = {})
34
+ Thread.current[KEY] = Thread.current[KEY].to_h.merge(hash)
35
+ end
36
+
37
+ def without!(*keys)
38
+ Thread.current[KEY] = Thread.current[KEY].to_h.except(*keys.flatten)
39
+ end
32
40
  end
33
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_dynamic_scope
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.6.9
110
+ rubygems_version: 4.0.10
111
111
  specification_version: 4
112
112
  summary: Handling dynamic scope for ActiveRecord.
113
113
  test_files: []