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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 737408d65cfb578650938ddb99b0055cdfc46a34941c20f6f5252ada91811316
4
- data.tar.gz: 2bada3234fc5cc47719e8dfdd1efbc86fd7b33c52ccbfcbf04f1f8f02f698d99
3
+ metadata.gz: 6034e3448587845c41b6595ffd518dd604e3ba1cf7a3ee5bfd664af9fe6cecf6
4
+ data.tar.gz: 6158fba39db05afde81030b86873ba01272ca4cff28adf5d567b7b388a1c90ac
5
5
  SHA512:
6
- metadata.gz: d17fea6caf102e1fcbd97e088bccb3870fd2b1adc9917044be84321f43d8172955b3f78353977f70363cfbf3b69fbb95e10cefade93a5f36a8b16be87647398d
7
- data.tar.gz: 0a607e37b3c6c9065796dd2f08c432feb7ffc6d3d70b44e28bcf3d8754290fea243c5f70d05b00546f911205abf7fee04ac34d670cc5f1982602783e9f867055
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.1...main
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 [![Gem Version](https://badge.fury.io/rb/dry-types.svg)][rubygem] [![CI Status](https://github.com/dry-rb/dry-types/workflows/CI/badge.svg)][actions]
7
9
 
10
+ [![Forum](https://img.shields.io/badge/Forum-dc360f?logo=discourse&logoColor=white)][forum]
11
+ [![Chat](https://img.shields.io/badge/Chat-717cf8?logo=discord&logoColor=white)][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.2"
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, &block)
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 ? block.call(result) : result
58
+ failed ? yield(result) : result
59
59
  else
60
- block.call
60
+ yield
61
61
  end
62
62
  end
63
63
 
@@ -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, &block)
73
- # block.call is slower in JRuby than yield, but in JRuby 10.0.2.0 there is a bug
74
- # with default block arguments, so block.call is chosen for correctness.
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]
@@ -18,7 +18,7 @@ module Dry
18
18
  # @see Dry::Types::Array#of
19
19
  #
20
20
  # @api public
21
- def schema(...) = type.schema(...).constructor(fn, meta: meta)
21
+ def schema(*, **, &) = type.schema(*, **, &).constructor(fn, meta: meta)
22
22
  end
23
23
  end
24
24
  end
@@ -100,8 +100,8 @@ module Dry
100
100
 
101
101
  if unknown
102
102
  raise ::ArgumentError,
103
- "#{unknown.inspect} is not a known type namespace. " \
104
- "Supported options are #{known.map(&:inspect).join(", ")}"
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
@@ -30,7 +30,7 @@ module Dry
30
30
 
31
31
  unless name.is_a?(::Symbol)
32
32
  raise ::ArgumentError,
33
- "Schemas can only contain symbol keys, #{name.inspect} given"
33
+ "Schemas can only contain symbol keys, #{name.inspect} given"
34
34
  end
35
35
 
36
36
  super
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Types
5
- VERSION = "1.9.1"
5
+ VERSION = "1.9.2"
6
6
  end
7
7
  end
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
- "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()"
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.1
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.2'
238
+ version: '3.3'
240
239
  required_rubygems_version: !ruby/object:Gem::Requirement
241
240
  requirements:
242
241
  - - ">="