dry-transaction 0.13.1 → 0.13.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: 6f40f750adc631d8bf596eaa4a2e1f57cdc0e5787104f23bab03888bff071aed
4
- data.tar.gz: 1ae8d029a3f723e114cdf10b7e06b2f71ab899ff8c75b6bb48f5a42b259053b1
3
+ metadata.gz: 625617cfd08882549ed80e2c6f9fca647b433b3c9b01f141722dd8e5e350ca93
4
+ data.tar.gz: 4c4eab3625d39e43ad4d8e867e07d161af1397220cae2ac95022e660f5120149
5
5
  SHA512:
6
- metadata.gz: 591876e98732125f3f800958c3885f7458b9866e3346a5f322194bd0c3b697cd1ae42994614f9065f64dd5e2014a937195254863e2075ff538bc874176fd4f77
7
- data.tar.gz: 287958b3d8ae478163ac45a4a6e17f4a7fa3d5e57fd778a710b5b5a1482b31e2c50690a43e63a843f4b56819bd693478ec40a05e3a1315c72ae03b095c860a79
6
+ metadata.gz: 400e487b067363922f1c03a218b6d3b078d3a43cecbf47d0d3f8419373c0007926aae5d71848927f8dd17fdb9db9abc398922d968aebee4af16f7a7ccd80307a
7
+ data.tar.gz: 1b577f303186b90200f292eca519f4de03b08ab67d5c15ead11f435d9c5a7319be49075f5b253907b05a0595b1cf40d8e4d17036638b323c35100e9774481688
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 0.13.1 2021-01-31
4
+
5
+
6
+ ### Changed
7
+
8
+ - Resolve Ruby 2.7 deprecation warnings and support Ruby 3.0 (@robbl-as in PR #134)
9
+
10
+ [Compare v0.13.0...v0.13.1](https://github.com/dry-rb/dry-transaction/compare/v0.13.0...v0.13.1)
11
+
3
12
  ## 0.13.0 2018-06-13
4
13
 
5
14
 
@@ -31,13 +31,26 @@ module Dry
31
31
  def call(*args, &block)
32
32
  if arity.zero?
33
33
  operation.(&block)
34
- elsif args.last.is_a?(Hash) && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
34
+ elsif ruby_27_last_arg_hash?(args)
35
35
  *prefix, last = args
36
36
  operation.(*prefix, **last, &block)
37
37
  else
38
38
  operation.(*args, &block)
39
39
  end
40
40
  end
41
+
42
+ private
43
+
44
+ # Ruby 2.7 gives a deprecation warning about passing a hash of parameters as the last argument
45
+ # to a method. Ruby 3.0 outright disallows it. This checks for that condition, but explicitly
46
+ # uses instance_of? rather than is_a? or kind_of?, because Hash like objects, specifically
47
+ # HashWithIndifferentAccess objects are provided by Rails as controller parameters, and often
48
+ # passed to dry-rb validators.
49
+ # In this case, it's better to leave the object as it's existing type, rather than implicitly
50
+ # convert it in to a hash with the double-splat (**) operator.
51
+ def ruby_27_last_arg_hash?(args)
52
+ args.last.instance_of?(Hash) && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
53
+ end
41
54
  end
42
55
  end
43
56
  end
@@ -3,6 +3,6 @@
3
3
  module Dry
4
4
  # Business transaction DSL.
5
5
  module Transaction
6
- VERSION = '0.13.1'.freeze
6
+ VERSION = '0.13.2'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-transaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-31 00:00:00.000000000 Z
11
+ date: 2021-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-container