dry-types 1.8.0 → 1.8.2

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: 506bb7b5eca44ddc06b248c28598dd58987cce24039e5991e7d659f41bed2235
4
- data.tar.gz: 363581b2882f4cc03844b9e78e2211b3ff6af0304ac5b122e64d7ef5e4c39271
3
+ metadata.gz: fb0a9688e1ae1fe5305d551dcedccbfa0dfca45a7949e5d357ad98edf0f4c8ef
4
+ data.tar.gz: a7dd52e7ff33aa2a1de7249bd2f03445db8b4632894e65cb8a70c1bc06dacbc5
5
5
  SHA512:
6
- metadata.gz: 70288750b129718df5082fd50a921250771c1c3d677ad673c0ca5a5f142b141ddd1804c25aeb8e7ec3fff59238ad12b8447eaa655cda6d5b79d499af7581bee9
7
- data.tar.gz: 190559f11fc01b46dcd419607ca8ae707681aba95843c76132d63c0a78b7ebc4037ee331b59a04f9c771b81dc8956b41cb13473a8ce224eaca8311351ca9ac02
6
+ metadata.gz: cb5a3673334cddda6541c1ec24a91343ce3eb4f50d4ccf4ca625350d5b0a81863fc2a75429995ff3332e89f1ac5c4eda183c5cee1b9522c8eb35828e718d309a
7
+ data.tar.gz: 217af029ec68360e982181764399ff9720ed0f2315aac2f671249ae9e91e4c0e18f3341a0580abdaf5e06bd490fab744dbafcffc1528fbc59587e869d487d7b7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 1.8.2 2025-01-31
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Syntax errors on 3.3.0 (@flash-gordon, see #478)
9
+
10
+
11
+ [Compare v1.8.1...v1.8.2](https://github.com/dry-rb/dry-types/compare/v1.8.1...v1.8.2)
12
+
13
+ ## 1.8.1 2025-01-21
14
+
15
+
16
+ ### Fixed
17
+
18
+ - Warnings about unused block arguments (@flash-gordon, #477)
19
+
20
+
21
+ [Compare v1.8.0...v1.8.1](https://github.com/dry-rb/dry-types/compare/v1.8.0...v1.8.1)
22
+
3
23
  ## 1.8.0 2025-01-06
4
24
 
5
25
 
@@ -90,7 +90,7 @@ module Dry
90
90
  # @param [Object] input
91
91
  #
92
92
  # @api public
93
- def try(input) = raise ::NotImplementedError
93
+ def try(input, &) = raise ::NotImplementedError
94
94
 
95
95
  # @api private
96
96
  def success(input)
@@ -37,7 +37,7 @@ module Dry
37
37
  # @see Dry::Types::Constrained#try
38
38
  #
39
39
  # @api public
40
- def try(input, &block)
40
+ def try(input, &)
41
41
  result = type.try(input)
42
42
 
43
43
  if result.success?
@@ -47,10 +47,10 @@ module Dry
47
47
  result
48
48
  else
49
49
  failure = failure(result.input, ConstraintError.new(validation, input))
50
- block ? yield(failure) : failure
50
+ block_given? ? yield(failure) : failure
51
51
  end
52
52
  else
53
- block ? yield(result) : result
53
+ block_given? ? yield(result) : result
54
54
  end
55
55
  end
56
56
  end
@@ -14,7 +14,7 @@ module Dry
14
14
  # @api private
15
15
  class Safe < Function
16
16
  def call(input, &)
17
- @fn.(input, &)
17
+ @fn.(input)
18
18
  rescue ::NoMethodError, ::TypeError, ::ArgumentError => e
19
19
  CoercionError.handle(e, &)
20
20
  end
@@ -74,7 +74,7 @@ module Dry
74
74
  # @return [Result::Success]
75
75
  #
76
76
  # @api public
77
- def try(input = Undefined)
77
+ def try(input = Undefined, &)
78
78
  if input.equal?(Undefined)
79
79
  success(evaluate)
80
80
  else
@@ -105,11 +105,11 @@ module Dry
105
105
  # @return [Object] value passed through {#type} or {#default} value
106
106
  #
107
107
  # @api private
108
- def call_safe(input = Undefined, &block)
108
+ def call_safe(input = Undefined, &)
109
109
  if input.equal?(Undefined)
110
110
  evaluate
111
111
  else
112
- Undefined.default(type.call_safe(input, &block)) { evaluate }
112
+ Undefined.default(type.call_safe(input, &)) { evaluate }
113
113
  end
114
114
  end
115
115
 
@@ -46,7 +46,7 @@ module Dry
46
46
  # @see Dry::Types::Constrained#try
47
47
  #
48
48
  # @api public
49
- def try(input) = super(map_value(input))
49
+ def try(input, &) = super(map_value(input))
50
50
 
51
51
  # @api private
52
52
  def default(*)
@@ -57,7 +57,7 @@ module Dry
57
57
  # @return [Result::Success]
58
58
  #
59
59
  # @api public
60
- def try(input = Undefined)
60
+ def try(input = Undefined, &)
61
61
  result = type.try(input)
62
62
 
63
63
  if result.success?
@@ -39,9 +39,9 @@ module Dry
39
39
  # @param [Object] input
40
40
  #
41
41
  # @api public
42
- def try(input)
42
+ def try(input, &)
43
43
  if left.try(input).success?
44
- right.try(input)
44
+ right.try(input, &)
45
45
  else
46
46
  Result::Success.new(input)
47
47
  end
data/lib/dry/types/lax.rb CHANGED
@@ -19,7 +19,7 @@ module Dry
19
19
  # @return [Object]
20
20
  #
21
21
  # @api public
22
- def call(input)
22
+ def call(input, &)
23
23
  type.call_safe(input) { |output = input| output }
24
24
  end
25
25
  alias_method :[], :call
@@ -77,7 +77,7 @@ module Dry
77
77
  # @return [BasicObject]
78
78
  #
79
79
  # @api private
80
- def call_safe(input) = input
80
+ def call_safe(input, &) = input
81
81
 
82
82
  # @param [Object] input
83
83
  #
@@ -88,7 +88,7 @@ module Dry
88
88
  # @return [nil] otherwise
89
89
  #
90
90
  # @api public
91
- def try(input) = success(input)
91
+ def try(input, &) = success(input)
92
92
 
93
93
  # @param (see Dry::Types::Success#initialize)
94
94
  #
@@ -7,7 +7,7 @@ module Dry
7
7
  # @return [String]
8
8
  #
9
9
  # @api private
10
- def to_s = PRINTER.(self) { super }
10
+ def to_s = PRINTER.(self)
11
11
  alias_method :inspect, :to_s
12
12
  end
13
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Types
5
- VERSION = "1.8.0"
5
+ VERSION = "1.8.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-06 00:00:00.000000000 Z
11
+ date: 2025-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal