dry-types 1.9.1 → 1.9.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 +4 -4
- data/CHANGELOG.md +10 -3
- data/README.md +6 -1
- data/dry-types.gemspec +1 -2
- data/lib/dry/types/array/member.rb +3 -3
- data/lib/dry/types/builder.rb +2 -2
- data/lib/dry/types/builder_methods.rb +1 -1
- data/lib/dry/types/constructor.rb +5 -9
- data/lib/dry/types/hash/constructor.rb +1 -1
- data/lib/dry/types/module.rb +2 -2
- data/lib/dry/types/predicate_inferrer.rb +2 -2
- data/lib/dry/types/schema/key.rb +1 -1
- data/lib/dry/types/version.rb +1 -1
- data/lib/dry/types.rb +3 -3
- metadata +2 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6034e3448587845c41b6595ffd518dd604e3ba1cf7a3ee5bfd664af9fe6cecf6
|
|
4
|
+
data.tar.gz: 6158fba39db05afde81030b86873ba01272ca4cff28adf5d567b7b388a1c90ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24f2c1d34d57cef59c2c59fcd2c3b4cdec7fc8093206605bd44ed802086f2c31f8a5ea66323703258511317d68b33be54db5c33e5f816a3a5923cf212a96bc23
|
|
7
|
+
data.tar.gz: 93863220f7f5d4114be9a806c40e47687e1e626a272e325513b02cdbcadb1d287f9144e569d582b52403325d0af0461c9f58b84089af028514f75e483c1960d5
|
data/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Break Versioning](https://www.taoensso.com/break-versioning).
|
|
7
6
|
|
|
8
7
|
## [Unreleased]
|
|
9
8
|
|
|
@@ -19,7 +18,15 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
|
|
|
19
18
|
|
|
20
19
|
### Security
|
|
21
20
|
|
|
22
|
-
[Unreleased]: https://github.com/dry-rb/dry-types/compare/v1.9.
|
|
21
|
+
[Unreleased]: https://github.com/dry-rb/dry-types/compare/v1.9.2...main
|
|
22
|
+
|
|
23
|
+
## [1.9.2] - 2026-11-19
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Work around a [JRuby bug](https://github.com/jruby/jruby/issues/10115). (@timriley in #499)
|
|
28
|
+
|
|
29
|
+
[1.9.2]: https://github.com/dry-rb/dry-types/compare/v1.9.1...v1.9.2
|
|
23
30
|
|
|
24
31
|
## [1.9.1] - 2026-02-06
|
|
25
32
|
|
data/README.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<!--- This file is synced from hanakai-rb/repo-sync -->
|
|
2
2
|
|
|
3
|
-
[rubygem]: https://rubygems.org/gems/dry-types
|
|
4
3
|
[actions]: https://github.com/dry-rb/dry-types/actions
|
|
4
|
+
[chat]: https://discord.gg/naQApPAsZB
|
|
5
|
+
[forum]: https://discourse.hanakai.org
|
|
6
|
+
[rubygem]: https://rubygems.org/gems/dry-types
|
|
5
7
|
|
|
6
8
|
# dry-types [][rubygem] [][actions]
|
|
7
9
|
|
|
10
|
+
[][forum]
|
|
11
|
+
[][chat]
|
|
12
|
+
|
|
8
13
|
## Links
|
|
9
14
|
|
|
10
15
|
- [User documentation](https://dry-rb.org/gems/dry-types)
|
data/dry-types.gemspec
CHANGED
|
@@ -23,13 +23,12 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
|
|
24
24
|
spec.extra_rdoc_files = ["README.md", "CHANGELOG.md", "LICENSE"]
|
|
25
25
|
|
|
26
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
27
26
|
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-types/blob/main/CHANGELOG.md"
|
|
28
27
|
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-types"
|
|
29
28
|
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-types/issues"
|
|
30
29
|
spec.metadata["funding_uri"] = "https://github.com/sponsors/hanami"
|
|
31
30
|
|
|
32
|
-
spec.required_ruby_version = ">= 3.
|
|
31
|
+
spec.required_ruby_version = ">= 3.3"
|
|
33
32
|
|
|
34
33
|
spec.add_runtime_dependency "bigdecimal", ">= 3.0"
|
|
35
34
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
|
@@ -42,7 +42,7 @@ module Dry
|
|
|
42
42
|
# @return [Array]
|
|
43
43
|
#
|
|
44
44
|
# @api private
|
|
45
|
-
def call_safe(input
|
|
45
|
+
def call_safe(input)
|
|
46
46
|
if primitive?(input)
|
|
47
47
|
failed = false
|
|
48
48
|
|
|
@@ -55,9 +55,9 @@ module Dry
|
|
|
55
55
|
output << coerced unless Undefined.equal?(coerced)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
failed ?
|
|
58
|
+
failed ? yield(result) : result
|
|
59
59
|
else
|
|
60
|
-
|
|
60
|
+
yield
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
data/lib/dry/types/builder.rb
CHANGED
|
@@ -68,8 +68,8 @@ module Dry
|
|
|
68
68
|
# @return [Constrained]
|
|
69
69
|
#
|
|
70
70
|
# @api public
|
|
71
|
-
def constrained(
|
|
72
|
-
constrained_type.new(self, rule: Types.Rule(
|
|
71
|
+
def constrained(*, **, &)
|
|
72
|
+
constrained_type.new(self, rule: Types.Rule(*, **, &))
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
# Turn a type into a type with a default value
|
|
@@ -77,7 +77,7 @@ module Dry
|
|
|
77
77
|
# @param [#call,nil] block Value constructor
|
|
78
78
|
#
|
|
79
79
|
# @return [Dry::Types::Type]
|
|
80
|
-
def Constructor(klass, cons = nil, &block) # rubocop:disable Metrics/PerceivedComplexity
|
|
80
|
+
def Constructor(klass, cons = nil, &block) # rubocop:disable Metrics/PerceivedComplexity
|
|
81
81
|
if klass.is_a?(Type)
|
|
82
82
|
if cons || block
|
|
83
83
|
klass.constructor(cons || block)
|
|
@@ -69,13 +69,9 @@ module Dry
|
|
|
69
69
|
# @return [Object]
|
|
70
70
|
#
|
|
71
71
|
# @api private
|
|
72
|
-
def call_safe(input
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# This was introduced in PR https://github.com/dry-rb/dry-types/pull/493, might be reverted
|
|
76
|
-
# in the bug is fixed in JRuby.
|
|
77
|
-
coerced = fn.(input) { |output = input| return block.call(output) }
|
|
78
|
-
type.call_safe(coerced) { |output = coerced| block.call(output) }
|
|
72
|
+
def call_safe(input)
|
|
73
|
+
coerced = fn.(input) { |output = input| return yield(output) }
|
|
74
|
+
type.call_safe(coerced) { |output = coerced| yield(output) }
|
|
79
75
|
end
|
|
80
76
|
|
|
81
77
|
# @return [Object]
|
|
@@ -177,9 +173,9 @@ module Dry
|
|
|
177
173
|
# @param [#call, nil] block
|
|
178
174
|
#
|
|
179
175
|
# @api private
|
|
180
|
-
def method_missing(method,
|
|
176
|
+
def method_missing(method, *, **, &)
|
|
181
177
|
if type.respond_to?(method)
|
|
182
|
-
response = type.public_send(method,
|
|
178
|
+
response = type.public_send(method, *, **, &)
|
|
183
179
|
|
|
184
180
|
if response.is_a?(Type) && response.instance_of?(type.class)
|
|
185
181
|
response.constructor_type[response, **options]
|
data/lib/dry/types/module.rb
CHANGED
|
@@ -100,8 +100,8 @@ module Dry
|
|
|
100
100
|
|
|
101
101
|
if unknown
|
|
102
102
|
raise ::ArgumentError,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
"#{unknown.inspect} is not a known type namespace. " \
|
|
104
|
+
"Supported options are #{known.map(&:inspect).join(", ")}"
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -99,7 +99,7 @@ module Dry
|
|
|
99
99
|
if !predicate.empty? && registry.key?(predicate[0])
|
|
100
100
|
predicate
|
|
101
101
|
else
|
|
102
|
-
[type?: type]
|
|
102
|
+
[{type?: type}]
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
|
@@ -178,7 +178,7 @@ module Dry
|
|
|
178
178
|
if values.empty?
|
|
179
179
|
[pred]
|
|
180
180
|
else
|
|
181
|
-
[pred => values[0]]
|
|
181
|
+
[{pred => values[0]}]
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
end
|
data/lib/dry/types/schema/key.rb
CHANGED
data/lib/dry/types/version.rb
CHANGED
data/lib/dry/types.rb
CHANGED
|
@@ -164,9 +164,9 @@ module Dry
|
|
|
164
164
|
|
|
165
165
|
if container.keys.any? { |key| key.split(".")[0] == underscored }
|
|
166
166
|
raise ::NameError,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
"dry-types does not define constants for default types. " \
|
|
168
|
+
"You can access the predefined types with [], e.g. Dry::Types['integer'] " \
|
|
169
|
+
"or generate a module with types using Dry.Types()"
|
|
170
170
|
else
|
|
171
171
|
super
|
|
172
172
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dry-types
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hanakai team
|
|
@@ -224,7 +224,6 @@ homepage: https://dry-rb.org/gems/dry-types
|
|
|
224
224
|
licenses:
|
|
225
225
|
- MIT
|
|
226
226
|
metadata:
|
|
227
|
-
allowed_push_host: https://rubygems.org
|
|
228
227
|
changelog_uri: https://github.com/dry-rb/dry-types/blob/main/CHANGELOG.md
|
|
229
228
|
source_code_uri: https://github.com/dry-rb/dry-types
|
|
230
229
|
bug_tracker_uri: https://github.com/dry-rb/dry-types/issues
|
|
@@ -236,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
236
235
|
requirements:
|
|
237
236
|
- - ">="
|
|
238
237
|
- !ruby/object:Gem::Version
|
|
239
|
-
version: '3.
|
|
238
|
+
version: '3.3'
|
|
240
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
240
|
requirements:
|
|
242
241
|
- - ">="
|