dry-types 1.5.0 → 1.6.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 +4 -4
- data/CHANGELOG.md +21 -1
- data/LICENSE +1 -1
- data/README.md +5 -4
- data/dry-types.gemspec +17 -15
- data/lib/dry/types/array/constructor.rb +0 -2
- data/lib/dry/types/array/member.rb +1 -3
- data/lib/dry/types/array.rb +0 -3
- data/lib/dry/types/builder.rb +4 -12
- data/lib/dry/types/builder_methods.rb +1 -1
- data/lib/dry/types/coercions/params.rb +4 -3
- data/lib/dry/types/compat.rb +1 -0
- data/lib/dry/types/compiler.rb +1 -3
- data/lib/dry/types/constrained.rb +0 -4
- data/lib/dry/types/constraints.rb +3 -7
- data/lib/dry/types/constructor/function.rb +8 -8
- data/lib/dry/types/constructor.rb +2 -7
- data/lib/dry/types/core.rb +2 -3
- data/lib/dry/types/decorator.rb +0 -2
- data/lib/dry/types/default.rb +3 -5
- data/lib/dry/types/enum.rb +0 -2
- data/lib/dry/types/errors.rb +13 -1
- data/lib/dry/types/extensions/maybe.rb +1 -2
- data/lib/dry/types/fn_container.rb +0 -2
- data/lib/dry/types/hash/constructor.rb +2 -4
- data/lib/dry/types/hash.rb +0 -5
- data/lib/dry/types/lax.rb +1 -4
- data/lib/dry/types/map.rb +9 -3
- data/lib/dry/types/module.rb +13 -8
- data/lib/dry/types/nominal.rb +2 -12
- data/lib/dry/types/predicate_inferrer.rb +3 -9
- data/lib/dry/types/predicate_registry.rb +24 -11
- data/lib/dry/types/primitive_inferrer.rb +0 -2
- data/lib/dry/types/printer.rb +12 -8
- data/lib/dry/types/result.rb +0 -2
- data/lib/dry/types/schema/key.rb +1 -4
- data/lib/dry/types/schema.rb +6 -4
- data/lib/dry/types/sum.rb +3 -6
- data/lib/dry/types/type.rb +1 -3
- data/lib/dry/types/version.rb +1 -1
- data/lib/dry/types.rb +41 -20
- metadata +27 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9875a9faf12df26231bd206db5e75e78cdb104277f34947b01e0d104537b63b4
|
4
|
+
data.tar.gz: 8358caef2ad9e5f83b635531b512f507a9b1776b26ba39f3b69090c6edcc1e71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bab1e2bb31fc25d9eb8765177717f985d433115cf756bcda8cdedf201bfca90627c942d5183962f428c7c2d67789b08ac95b2e3e0b741c7cccbd39d13ab0ba6
|
7
|
+
data.tar.gz: caa7de7d979423fd8d8b5dd0b64642104f40029dcfeec7fe81ff05ef516c76d4bef1a59e341d0580b15022429a3f0d8a89c2f6170fdab0f398c330f157e4cf43
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
-
## 1.
|
3
|
+
## 1.6.0 2022-10-15
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
|
8
|
+
- Optimize `PredicateRegistry` for Ruby 2.7+ (see #420 for more details) (@casperisfine)
|
9
|
+
- Use zeitwerk for auto-loading (@flash-gordon)
|
10
|
+
|
11
|
+
[Compare v1.5.1...v1.6.0](https://github.com/dry-rb/dry-types/compare/v1.5.1...v1.6.0)
|
12
|
+
|
13
|
+
## 1.5.1 2021-02-16
|
14
|
+
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- Add missing requires for internal usage of `Dry::Equalizer` (@timriley in #418)
|
19
|
+
|
20
|
+
|
21
|
+
[Compare v1.5.0...v1.5.1](https://github.com/dry-rb/dry-types/compare/v1.5.0...v1.5.1)
|
22
|
+
|
23
|
+
## 1.5.0 2021-01-21
|
4
24
|
|
5
25
|
|
6
26
|
### Added
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
<!--- this file is synced from dry-rb/template-gem project -->
|
1
2
|
[gem]: https://rubygems.org/gems/dry-types
|
2
3
|
[actions]: https://github.com/dry-rb/dry-types/actions
|
3
4
|
[codacy]: https://www.codacy.com/gh/dry-rb/dry-types
|
@@ -10,19 +11,19 @@
|
|
10
11
|
[][actions]
|
11
12
|
[][codacy]
|
12
13
|
[][codacy]
|
13
|
-
[][inchpages]
|
14
15
|
|
15
16
|
## Links
|
16
17
|
|
17
|
-
* [User documentation](
|
18
|
+
* [User documentation](https://dry-rb.org/gems/dry-types)
|
18
19
|
* [API documentation](http://rubydoc.info/gems/dry-types)
|
19
20
|
|
20
21
|
## Supported Ruby versions
|
21
22
|
|
22
23
|
This library officially supports the following Ruby versions:
|
23
24
|
|
24
|
-
* MRI
|
25
|
-
* jruby
|
25
|
+
* MRI `>= 2.7.0`
|
26
|
+
* jruby `>= 9.3` (postponed until 2.7 is supported)
|
26
27
|
|
27
28
|
## License
|
28
29
|
|
data/dry-types.gemspec
CHANGED
@@ -1,38 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# this file is managed by dry-rb/devtools project
|
3
2
|
|
4
|
-
|
3
|
+
# this file is synced from dry-rb/template-gem project
|
4
|
+
|
5
|
+
lib = File.expand_path("lib", __dir__)
|
5
6
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
-
require
|
7
|
+
require "dry/types/version"
|
7
8
|
|
8
9
|
Gem::Specification.new do |spec|
|
9
|
-
spec.name =
|
10
|
+
spec.name = "dry-types"
|
10
11
|
spec.authors = ["Piotr Solnica"]
|
11
12
|
spec.email = ["piotr.solnica@gmail.com"]
|
12
|
-
spec.license =
|
13
|
+
spec.license = "MIT"
|
13
14
|
spec.version = Dry::Types::VERSION.dup
|
14
15
|
|
15
16
|
spec.summary = "Type system for Ruby supporting coercions, constraints and complex types like structs, value objects, enums etc"
|
16
17
|
spec.description = spec.summary
|
17
|
-
spec.homepage =
|
18
|
+
spec.homepage = "https://dry-rb.org/gems/dry-types"
|
18
19
|
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-types.gemspec", "lib/**/*"]
|
19
|
-
spec.bindir =
|
20
|
+
spec.bindir = "bin"
|
20
21
|
spec.executables = []
|
21
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ["lib"]
|
22
23
|
|
23
|
-
spec.metadata[
|
24
|
-
spec.metadata[
|
25
|
-
spec.metadata[
|
26
|
-
spec.metadata[
|
24
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-types/blob/main/CHANGELOG.md"
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-types"
|
27
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-types/issues"
|
27
28
|
|
28
|
-
spec.required_ruby_version = ">= 2.
|
29
|
+
spec.required_ruby_version = ">= 2.7.0"
|
29
30
|
|
30
31
|
# to update dependencies edit project.yml
|
31
32
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
32
33
|
spec.add_runtime_dependency "dry-container", "~> 0.3"
|
33
|
-
spec.add_runtime_dependency "dry-core", "~> 0.
|
34
|
+
spec.add_runtime_dependency "dry-core", "~> 0.9", ">= 0.9"
|
34
35
|
spec.add_runtime_dependency "dry-inflector", "~> 0.1", ">= 0.1.2"
|
35
|
-
spec.add_runtime_dependency "dry-logic", "~> 1.
|
36
|
+
spec.add_runtime_dependency "dry-logic", "~> 1.3", ">= 1.3"
|
37
|
+
spec.add_runtime_dependency "zeitwerk", "~> 2.6"
|
36
38
|
|
37
39
|
spec.add_development_dependency "bundler"
|
38
40
|
spec.add_development_dependency "dry-monads", "~> 1.0"
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/array/constructor"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
class Array < Nominal
|
@@ -72,7 +70,7 @@ module Dry
|
|
72
70
|
# @return [Result,Logic::Result]
|
73
71
|
#
|
74
72
|
# @api public
|
75
|
-
def try(input, &block)
|
73
|
+
def try(input, &block) # rubocop:disable Metrics/PerceivedComplexity
|
76
74
|
if primitive?(input)
|
77
75
|
output = []
|
78
76
|
|
data/lib/dry/types/array.rb
CHANGED
data/lib/dry/types/builder.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/deprecations"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# Common API for building types and composition
|
@@ -76,7 +74,7 @@ module Dry
|
|
76
74
|
" value every time. Call `.freeze` when setting the default"\
|
77
75
|
" or pass `shared: true` to discard this warning."\
|
78
76
|
"\n#{where}",
|
79
|
-
tag: :
|
77
|
+
tag: :"dry-types"
|
80
78
|
)
|
81
79
|
end
|
82
80
|
|
@@ -105,7 +103,7 @@ module Dry
|
|
105
103
|
if values.length == 1 && values[0].is_a?(::Hash)
|
106
104
|
values[0]
|
107
105
|
else
|
108
|
-
|
106
|
+
values.zip(values).to_h
|
109
107
|
end
|
110
108
|
|
111
109
|
Enum.new(constrained(included_in: mapping.keys), mapping: mapping)
|
@@ -147,7 +145,7 @@ module Dry
|
|
147
145
|
# @return [Constructor]
|
148
146
|
#
|
149
147
|
# @api public
|
150
|
-
def fallback(value = Undefined, shared: false, &_fallback)
|
148
|
+
def fallback(value = Undefined, shared: false, &_fallback) # rubocop:disable Metrics/PerceivedComplexity
|
151
149
|
if Undefined.equal?(value) && !block_given?
|
152
150
|
raise ::ArgumentError, "fallback value or a block must be given"
|
153
151
|
end
|
@@ -167,7 +165,7 @@ module Dry
|
|
167
165
|
" value every time. Call `.freeze` when setting the fallback"\
|
168
166
|
" or pass `shared: true` to discard this warning."\
|
169
167
|
"\n#{where}",
|
170
|
-
tag: :
|
168
|
+
tag: :"dry-types"
|
171
169
|
)
|
172
170
|
end
|
173
171
|
|
@@ -184,9 +182,3 @@ module Dry
|
|
184
182
|
end
|
185
183
|
end
|
186
184
|
end
|
187
|
-
|
188
|
-
require "dry/types/default"
|
189
|
-
require "dry/types/constrained"
|
190
|
-
require "dry/types/enum"
|
191
|
-
require "dry/types/lax"
|
192
|
-
require "dry/types/sum"
|
@@ -80,7 +80,7 @@ module Dry
|
|
80
80
|
# @param [#call,nil] block Value constructor
|
81
81
|
#
|
82
82
|
# @return [Dry::Types::Type]
|
83
|
-
def Constructor(klass, cons = nil, &block)
|
83
|
+
def Constructor(klass, cons = nil, &block) # rubocop:disable Metrics/PerceivedComplexity:
|
84
84
|
if klass.is_a?(Type)
|
85
85
|
if cons || block
|
86
86
|
klass.constructor(cons || block)
|
@@ -12,9 +12,10 @@ module Dry
|
|
12
12
|
module Params
|
13
13
|
TRUE_VALUES = %w[1 on On ON t true True TRUE T y yes Yes YES Y].freeze
|
14
14
|
FALSE_VALUES = %w[0 off Off OFF f false False FALSE F n no No NO N].freeze
|
15
|
-
BOOLEAN_MAP =
|
16
|
-
|
17
|
-
|
15
|
+
BOOLEAN_MAP = EMPTY_HASH.merge(
|
16
|
+
[true, *TRUE_VALUES].to_h { |v| [v, true] },
|
17
|
+
[false, *FALSE_VALUES].to_h { |v| [v, false] }
|
18
|
+
).freeze
|
18
19
|
|
19
20
|
extend Coercions
|
20
21
|
|
data/lib/dry/types/compat.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
# frozen_string_literal: true
|
data/lib/dry/types/compiler.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/deprecations"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# @api private
|
8
6
|
class Compiler
|
9
|
-
extend ::Dry::Core::Deprecations[:
|
7
|
+
extend ::Dry::Core::Deprecations[:"dry-types"]
|
10
8
|
|
11
9
|
attr_reader :registry
|
12
10
|
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/logic/rule_compiler"
|
4
|
-
require "dry/logic/predicates"
|
5
|
-
require "dry/logic/rule/predicate"
|
6
|
-
|
7
3
|
module Dry
|
8
4
|
# Helper methods for constraint types
|
9
5
|
#
|
@@ -17,8 +13,8 @@ module Dry
|
|
17
13
|
def self.Rule(options)
|
18
14
|
rule_compiler.(
|
19
15
|
options.map { |key, val|
|
20
|
-
Logic::Rule::Predicate.build(
|
21
|
-
Logic::Predicates[:"#{key}?"]
|
16
|
+
::Dry::Logic::Rule::Predicate.build(
|
17
|
+
::Dry::Logic::Predicates[:"#{key}?"]
|
22
18
|
).curry(val).to_ast
|
23
19
|
}
|
24
20
|
).reduce(:and)
|
@@ -28,7 +24,7 @@ module Dry
|
|
28
24
|
#
|
29
25
|
# @api private
|
30
26
|
def self.rule_compiler
|
31
|
-
@rule_compiler ||= Logic::RuleCompiler.new(Logic::Predicates)
|
27
|
+
@rule_compiler ||= ::Dry::Logic::RuleCompiler.new(::Dry::Logic::Predicates)
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
@@ -61,17 +61,17 @@ module Dry
|
|
61
61
|
::Module.new do
|
62
62
|
if safe
|
63
63
|
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
64
|
-
def call(input, &block)
|
65
|
-
@target.#{method}(input, &block)
|
66
|
-
end
|
64
|
+
def call(input, &block) # def call(input, &block)
|
65
|
+
@target.#{method}(input, &block) # @target.coerve(input, &block)
|
66
|
+
end # end
|
67
67
|
RUBY
|
68
68
|
else
|
69
69
|
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
70
|
-
def call(input, &block)
|
71
|
-
@target.#{method}(input)
|
72
|
-
rescue ::NoMethodError, ::TypeError, ::ArgumentError => error
|
73
|
-
CoercionError.handle(error, &block)
|
74
|
-
end
|
70
|
+
def call(input, &block) # def call(input, &block)
|
71
|
+
@target.#{method}(input) # @target.coerce(input)
|
72
|
+
rescue ::NoMethodError, ::TypeError, ::ArgumentError => error # rescue ::NoMethodError, ::TypeError, ::ArgumentError => error
|
73
|
+
CoercionError.handle(error, &block) # CoercionError.handle(error, &block)
|
74
|
+
end # end
|
75
75
|
RUBY
|
76
76
|
end
|
77
77
|
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/fn_container"
|
4
|
-
require "dry/types/constructor/function"
|
5
|
-
require "dry/types/constructor/wrapper"
|
6
|
-
|
7
3
|
module Dry
|
8
4
|
module Types
|
9
5
|
# Constructor types apply a function to the input that is supposed to return
|
@@ -48,13 +44,12 @@ module Dry
|
|
48
44
|
|
49
45
|
# @api private
|
50
46
|
def self.wrapper_type
|
51
|
-
@wrapper_type ||=
|
47
|
+
@wrapper_type ||=
|
52
48
|
if self < Wrapper
|
53
49
|
self
|
54
50
|
else
|
55
51
|
const_set(:Wrapping, ::Class.new(self).include(Wrapper))
|
56
52
|
end
|
57
|
-
end
|
58
53
|
end
|
59
54
|
|
60
55
|
# Instantiate a new constructor type instance
|
@@ -190,7 +185,7 @@ module Dry
|
|
190
185
|
if type.respond_to?(method)
|
191
186
|
response = type.public_send(method, *args, &block)
|
192
187
|
|
193
|
-
if response.is_a?(Type) &&
|
188
|
+
if response.is_a?(Type) && response.instance_of?(type.class)
|
194
189
|
response.constructor_type[response, **options]
|
195
190
|
else
|
196
191
|
response
|
data/lib/dry/types/core.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/any"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# Primitives with {Kernel} coercion methods
|
@@ -60,7 +58,8 @@ module Dry
|
|
60
58
|
|
61
59
|
# Register {KERNEL_COERCIBLE} types
|
62
60
|
KERNEL_COERCIBLE.each do |name, primitive|
|
63
|
-
register("coercible.#{name}",
|
61
|
+
register("coercible.#{name}",
|
62
|
+
self["nominal.#{name}"].constructor(Kernel.method(primitive.name)))
|
64
63
|
end
|
65
64
|
|
66
65
|
# Register {METHOD_COERCIBLE} types
|
data/lib/dry/types/decorator.rb
CHANGED
data/lib/dry/types/default.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/decorator"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# Default types are useful when a missing value should be replaced by a default one
|
@@ -52,7 +50,7 @@ module Dry
|
|
52
50
|
# @param [Object] value
|
53
51
|
#
|
54
52
|
# @api private
|
55
|
-
def initialize(type, value, **
|
53
|
+
def initialize(type, value, **)
|
56
54
|
super
|
57
55
|
@value = value
|
58
56
|
end
|
@@ -64,8 +62,8 @@ module Dry
|
|
64
62
|
# @return [Default]
|
65
63
|
#
|
66
64
|
# @api public
|
67
|
-
def constrained(
|
68
|
-
type.constrained(
|
65
|
+
def constrained(...)
|
66
|
+
type.constrained(...).default(value)
|
69
67
|
end
|
70
68
|
|
71
69
|
# @return [true]
|
data/lib/dry/types/enum.rb
CHANGED
data/lib/dry/types/errors.rb
CHANGED
@@ -51,6 +51,7 @@ module Dry
|
|
51
51
|
|
52
52
|
# @param [Array<CoercionError>] errors
|
53
53
|
def initialize(errors)
|
54
|
+
super("")
|
54
55
|
@errors = errors
|
55
56
|
end
|
56
57
|
|
@@ -66,11 +67,22 @@ module Dry
|
|
66
67
|
end
|
67
68
|
|
68
69
|
class SchemaError < CoercionError
|
70
|
+
# @return [String, Symbol]
|
71
|
+
attr_reader :key
|
72
|
+
|
73
|
+
# @return [Object]
|
74
|
+
attr_reader :value
|
75
|
+
|
69
76
|
# @param [String,Symbol] key
|
70
77
|
# @param [Object] value
|
71
78
|
# @param [String, #to_s] result
|
72
79
|
def initialize(key, value, result)
|
73
|
-
|
80
|
+
@key = key
|
81
|
+
@value = value
|
82
|
+
super(
|
83
|
+
"#{value.inspect} (#{value.class}) has invalid type "\
|
84
|
+
"for :#{key} violates constraints (#{result} failed)"
|
85
|
+
)
|
74
86
|
end
|
75
87
|
end
|
76
88
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads/maybe"
|
4
|
-
require "dry/types/decorator"
|
5
4
|
|
6
5
|
module Dry
|
7
6
|
module Types
|
@@ -98,7 +97,7 @@ module Dry
|
|
98
97
|
end
|
99
98
|
|
100
99
|
# @api private
|
101
|
-
class Schema::Key
|
100
|
+
class Schema::Key # rubocop:disable Style/ClassAndModuleChildren
|
102
101
|
# @api private
|
103
102
|
def maybe
|
104
103
|
__new__(type.maybe)
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/constructor"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# Hash type exposes additional APIs for working with schema hashes
|
@@ -24,8 +22,8 @@ module Dry
|
|
24
22
|
# @see Dry::Types::Array#of
|
25
23
|
#
|
26
24
|
# @api public
|
27
|
-
def schema(
|
28
|
-
type.schema(
|
25
|
+
def schema(...)
|
26
|
+
type.schema(...).constructor(fn, meta: meta)
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
data/lib/dry/types/hash.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/hash/constructor"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# Hash types can be used to define maps and schemas
|
@@ -132,6 +130,3 @@ module Dry
|
|
132
130
|
end
|
133
131
|
end
|
134
132
|
end
|
135
|
-
|
136
|
-
require "dry/types/schema/key"
|
137
|
-
require "dry/types/schema"
|
data/lib/dry/types/lax.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/deprecations"
|
4
|
-
require "dry/types/decorator"
|
5
|
-
|
6
3
|
module Dry
|
7
4
|
module Types
|
8
5
|
# Lax types rescue from type-related errors when constructors fail
|
@@ -68,7 +65,7 @@ module Dry
|
|
68
65
|
end
|
69
66
|
end
|
70
67
|
|
71
|
-
extend ::Dry::Core::Deprecations[:
|
68
|
+
extend ::Dry::Core::Deprecations[:"dry-types"]
|
72
69
|
Safe = Lax
|
73
70
|
deprecate_constant(:Safe)
|
74
71
|
end
|
data/lib/dry/types/map.rb
CHANGED
@@ -14,15 +14,17 @@ module Dry
|
|
14
14
|
# # => {1 => 'right'}
|
15
15
|
#
|
16
16
|
# type.('1' => 'wrong')
|
17
|
-
# # Dry::Types::MapError: "1" violates constraints (type?(Integer, "1")
|
17
|
+
# # Dry::Types::MapError: "1" violates constraints (type?(Integer, "1")
|
18
|
+
# # AND gteq?(1, "1")
|
19
|
+
# # AND lteq?(10, "1") failed)
|
18
20
|
#
|
19
21
|
# type.(11 => 'wrong')
|
20
22
|
# # Dry::Types::MapError: 11 violates constraints (lteq?(10, 11) failed)
|
21
23
|
#
|
22
24
|
# @api public
|
23
25
|
class Map < Nominal
|
24
|
-
def initialize(
|
25
|
-
super(
|
26
|
+
def initialize(primitive, key_type: Types["any"], value_type: Types["any"], meta: EMPTY_HASH)
|
27
|
+
super(primitive, key_type: key_type, value_type: value_type, meta: meta)
|
26
28
|
end
|
27
29
|
|
28
30
|
# @return [Type]
|
@@ -100,6 +102,8 @@ module Dry
|
|
100
102
|
private
|
101
103
|
|
102
104
|
# @api private
|
105
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
106
|
+
# rubocop:disable Metrics/AbcSize
|
103
107
|
def coerce(input)
|
104
108
|
unless primitive?(input)
|
105
109
|
return failure(
|
@@ -131,6 +135,8 @@ module Dry
|
|
131
135
|
failure(input, MultipleError.new(failures))
|
132
136
|
end
|
133
137
|
end
|
138
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
139
|
+
# rubocop:enable Metrics/AbcSize
|
134
140
|
end
|
135
141
|
end
|
136
142
|
end
|
data/lib/dry/types/module.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/deprecations"
|
4
|
-
require "dry/types/builder_methods"
|
5
|
-
|
6
3
|
module Dry
|
7
4
|
module Types
|
8
5
|
# Export types registered in a container as module constants.
|
9
6
|
# @example
|
10
7
|
# module Types
|
11
|
-
# include Dry
|
8
|
+
# include Dry.Types(:strict, :coercible, :nominal, default: :strict)
|
12
9
|
# end
|
13
10
|
#
|
14
11
|
# Types.constants
|
@@ -26,10 +23,10 @@ module Dry
|
|
26
23
|
extend(BuilderMethods)
|
27
24
|
|
28
25
|
if constants.key?(:Nominal)
|
29
|
-
singleton_class.
|
26
|
+
singleton_class.define_method(:included) do |base|
|
30
27
|
super(base)
|
31
28
|
base.instance_exec(const_get(:Nominal, false)) do |nominal|
|
32
|
-
extend Dry::Core::Deprecations[:
|
29
|
+
extend Dry::Core::Deprecations[:"dry-types"]
|
33
30
|
const_set(:Definition, nominal)
|
34
31
|
deprecate_constant(:Definition, message: "Nominal")
|
35
32
|
end
|
@@ -38,6 +35,9 @@ module Dry
|
|
38
35
|
end
|
39
36
|
|
40
37
|
# @api private
|
38
|
+
# rubocop:disable Metrics/AbcSize
|
39
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
40
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
41
41
|
def type_constants(*namespaces, default: Undefined, **aliases)
|
42
42
|
if namespaces.empty? && aliases.empty? && Undefined.equal?(default)
|
43
43
|
default_ns = :Strict
|
@@ -64,6 +64,9 @@ module Dry
|
|
64
64
|
constants.update(value) if key == default_ns
|
65
65
|
end
|
66
66
|
end
|
67
|
+
# rubocop:enable Metrics/AbcSize
|
68
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
69
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
67
70
|
|
68
71
|
# @api private
|
69
72
|
def registry_tree
|
@@ -91,9 +94,11 @@ module Dry
|
|
91
94
|
ns.to_sym unless path.empty?
|
92
95
|
}.compact.uniq
|
93
96
|
|
94
|
-
(referenced.uniq - known).
|
97
|
+
unknown = (referenced.uniq - known).first
|
98
|
+
|
99
|
+
if unknown
|
95
100
|
raise ArgumentError,
|
96
|
-
"#{
|
101
|
+
"#{unknown.inspect} is not a known type namespace. "\
|
97
102
|
"Supported options are #{known.map(&:inspect).join(", ")}"
|
98
103
|
end
|
99
104
|
end
|
data/lib/dry/types/nominal.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/deprecations"
|
4
|
-
require "dry/types/builder"
|
5
|
-
require "dry/types/result"
|
6
|
-
require "dry/types/options"
|
7
|
-
require "dry/types/meta"
|
8
|
-
|
9
3
|
module Dry
|
10
4
|
module Types
|
11
5
|
# Nominal types define a primitive class and do not apply any constructors or constraints
|
@@ -19,7 +13,7 @@ module Dry
|
|
19
13
|
include Meta
|
20
14
|
include Builder
|
21
15
|
include Printable
|
22
|
-
include Dry::Equalizer(:primitive, :options, :meta, inspect: false, immutable: true)
|
16
|
+
include ::Dry::Equalizer(:primitive, :options, :meta, inspect: false, immutable: true)
|
23
17
|
|
24
18
|
# @return [Class]
|
25
19
|
attr_reader :primitive
|
@@ -198,12 +192,8 @@ module Dry
|
|
198
192
|
end
|
199
193
|
end
|
200
194
|
|
201
|
-
extend Dry::Core::Deprecations[:
|
195
|
+
extend ::Dry::Core::Deprecations[:"dry-types"]
|
202
196
|
Definition = Nominal
|
203
197
|
deprecate_constant(:Definition, message: "Nominal")
|
204
198
|
end
|
205
199
|
end
|
206
|
-
|
207
|
-
require "dry/types/array"
|
208
|
-
require "dry/types/hash"
|
209
|
-
require "dry/types/map"
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/cache"
|
4
|
-
require "dry/core/class_attributes"
|
5
|
-
require "dry/types/predicate_registry"
|
6
|
-
|
7
3
|
module Dry
|
8
4
|
module Types
|
9
5
|
# PredicateInferrer returns the list of predicates used by a type.
|
@@ -55,7 +51,7 @@ module Dry
|
|
55
51
|
end
|
56
52
|
|
57
53
|
# @api private
|
58
|
-
def infer_predicate(type)
|
54
|
+
def infer_predicate(type) # rubocop:disable Metrics/PerceivedComplexity
|
59
55
|
pred = TYPE_TO_PREDICATE.fetch(type) do
|
60
56
|
if type.name.nil? || self.class.infer_predicate_by_class_name.equal?(false)
|
61
57
|
nil
|
@@ -175,9 +171,9 @@ module Dry
|
|
175
171
|
def visit_predicate(node)
|
176
172
|
pred, args = node
|
177
173
|
|
178
|
-
if pred.equal?(:type?)
|
174
|
+
if pred.equal?(:type?) || !registry.key?(pred)
|
179
175
|
EMPTY_ARRAY
|
180
|
-
|
176
|
+
else
|
181
177
|
*curried, _ = args
|
182
178
|
values = curried.map { |_, v| v }
|
183
179
|
|
@@ -186,8 +182,6 @@ module Dry
|
|
186
182
|
else
|
187
183
|
[pred => values[0]]
|
188
184
|
end
|
189
|
-
else
|
190
|
-
EMPTY_ARRAY
|
191
185
|
end
|
192
186
|
end
|
193
187
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/logic/predicates"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# A registry with predicate objects from `Dry::Logic::Predicates`
|
@@ -14,21 +12,36 @@ module Dry
|
|
14
12
|
# @api private
|
15
13
|
attr_reader :has_predicate
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
KERNEL_RESPOND_TO = ::Kernel.instance_method(:respond_to?)
|
16
|
+
private_constant(:KERNEL_RESPOND_TO)
|
17
|
+
|
18
|
+
if ::UnboundMethod.method_defined?(:bind_call)
|
19
|
+
# @api private
|
20
|
+
def initialize(predicates = Logic::Predicates)
|
21
|
+
@predicates = predicates
|
22
|
+
end
|
23
|
+
|
24
|
+
# @api private
|
25
|
+
def key?(name)
|
26
|
+
KERNEL_RESPOND_TO.bind_call(@predicates, name)
|
27
|
+
end
|
28
|
+
else
|
29
|
+
# @api private
|
30
|
+
def initialize(predicates = Logic::Predicates)
|
31
|
+
@predicates = predicates
|
32
|
+
@has_predicate = KERNEL_RESPOND_TO.bind(@predicates)
|
33
|
+
end
|
34
|
+
|
35
|
+
# @api private
|
36
|
+
def key?(name)
|
37
|
+
has_predicate.(name)
|
38
|
+
end
|
21
39
|
end
|
22
40
|
|
23
41
|
# @api private
|
24
42
|
def [](name)
|
25
43
|
predicates[name]
|
26
44
|
end
|
27
|
-
|
28
|
-
# @api private
|
29
|
-
def key?(name)
|
30
|
-
has_predicate.(name)
|
31
|
-
end
|
32
45
|
end
|
33
46
|
end
|
34
47
|
end
|
data/lib/dry/types/printer.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Dry
|
4
|
+
# rubocop:disable Metrics/AbcSize
|
5
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
4
6
|
module Types
|
5
7
|
# @api private
|
6
8
|
class Printer
|
7
|
-
MAPPING = {
|
9
|
+
MAPPING = { # rubocop:disable Style/MutableConstant
|
8
10
|
Nominal => :visit_nominal,
|
9
11
|
Constructor => :visit_constructor,
|
10
12
|
Constrained => :visit_constrained,
|
@@ -94,13 +96,13 @@ module Dry
|
|
94
96
|
|
95
97
|
strict_str = "strict " if options.delete(:strict)
|
96
98
|
|
97
|
-
if key_fn = options.delete(:key_transform_fn)
|
99
|
+
if (key_fn = options.delete(:key_transform_fn))
|
98
100
|
visit_callable(key_fn) do |fn|
|
99
101
|
key_fn_str = "key_fn=#{fn} "
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
|
-
if type_fn = options.delete(:type_transform_fn)
|
105
|
+
if (type_fn = options.delete(:type_transform_fn))
|
104
106
|
visit_callable(type_fn) do |fn|
|
105
107
|
type_fn_str = "type_fn=#{fn} "
|
106
108
|
end
|
@@ -109,7 +111,7 @@ module Dry
|
|
109
111
|
keys = options.delete(:keys)
|
110
112
|
|
111
113
|
visit_options(options, schema.meta) do |opts|
|
112
|
-
opts = "#{opts[1
|
114
|
+
opts = "#{opts[1..]} " unless opts.empty?
|
113
115
|
schema_parameters = "#{key_fn_str}#{type_fn_str}#{strict_str}#{opts}"
|
114
116
|
|
115
117
|
header = "Schema<#{schema_parameters}keys={"
|
@@ -236,7 +238,7 @@ module Dry
|
|
236
238
|
options = hash.options.dup
|
237
239
|
type_fn_str = ""
|
238
240
|
|
239
|
-
if type_fn = options.delete(:type_transform_fn)
|
241
|
+
if (type_fn = options.delete(:type_transform_fn))
|
240
242
|
visit_callable(type_fn) do |fn|
|
241
243
|
type_fn_str = "type_fn=#{fn}"
|
242
244
|
end
|
@@ -263,9 +265,9 @@ module Dry
|
|
263
265
|
if line&.zero?
|
264
266
|
yield ".#{path}"
|
265
267
|
elsif path
|
266
|
-
yield "#{path.sub(Dir.pwd
|
268
|
+
yield "#{path.sub("#{Dir.pwd}/", EMPTY_STRING)}:#{line}"
|
267
269
|
else
|
268
|
-
match = fn.to_s.match(/\A#<Proc:0x\h+\(&:(?<name>\w+)\)(:? \(lambda\))?>\z/)
|
270
|
+
match = fn.to_s.match(/\A#<Proc:0x\h+\(&:(?<name>\w+)\)(:? \(lambda\))?>\z/) # rubocop:disable Lint/MixedRegexpCaptureTypes
|
269
271
|
|
270
272
|
if match
|
271
273
|
yield ".#{match[:name]}"
|
@@ -286,7 +288,7 @@ module Dry
|
|
286
288
|
end
|
287
289
|
end
|
288
290
|
|
289
|
-
def visit_options(options, meta = EMPTY_HASH)
|
291
|
+
def visit_options(options, meta = EMPTY_HASH) # rubocop:disable Metrics/PerceivedComplexity
|
290
292
|
if options.empty? && meta.empty?
|
291
293
|
yield ""
|
292
294
|
else
|
@@ -312,4 +314,6 @@ module Dry
|
|
312
314
|
|
313
315
|
PRINTER = Printer.new.freeze
|
314
316
|
end
|
317
|
+
# rubocop:enable Metrics/AbcSize
|
318
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
315
319
|
end
|
data/lib/dry/types/result.rb
CHANGED
data/lib/dry/types/schema/key.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/equalizer"
|
4
|
-
require "dry/core/deprecations"
|
5
|
-
|
6
3
|
module Dry
|
7
4
|
module Types
|
8
5
|
# Schema is a hash with explicit member types defined
|
@@ -15,7 +12,7 @@ module Dry
|
|
15
12
|
#
|
16
13
|
# @see Dry::Types::Schema
|
17
14
|
class Key
|
18
|
-
extend ::Dry::Core::Deprecations[:
|
15
|
+
extend ::Dry::Core::Deprecations[:"dry-types"]
|
19
16
|
include Type
|
20
17
|
include Dry::Equalizer(:name, :type, :options, inspect: false, immutable: true)
|
21
18
|
include Decorator
|
data/lib/dry/types/schema.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/fn_container"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# The built-in Hash type can be defined in terms of keys and associated types
|
@@ -92,6 +90,8 @@ module Dry
|
|
92
90
|
# @return [Object] if coercion fails and a block is given
|
93
91
|
#
|
94
92
|
# @api public
|
93
|
+
# rubocop:disable Metrics/AbcSize
|
94
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
95
95
|
def try(input)
|
96
96
|
if primitive?(input)
|
97
97
|
success = true
|
@@ -138,6 +138,8 @@ module Dry
|
|
138
138
|
failure
|
139
139
|
end
|
140
140
|
end
|
141
|
+
# rubocop:enable Metrics/AbcSize
|
142
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
141
143
|
|
142
144
|
# @param meta [Boolean] Whether to dump the meta to the AST
|
143
145
|
#
|
@@ -167,7 +169,7 @@ module Dry
|
|
167
169
|
# @return [Schema]
|
168
170
|
#
|
169
171
|
# @api public
|
170
|
-
def strict(strict = true)
|
172
|
+
def strict(strict = true) # rubocop:disable Style/OptionalBooleanParameter
|
171
173
|
with(strict: strict)
|
172
174
|
end
|
173
175
|
|
@@ -368,7 +370,7 @@ module Dry
|
|
368
370
|
# Try to add missing keys to the hash
|
369
371
|
#
|
370
372
|
# @api private
|
371
|
-
def resolve_missing_keys(hash, options)
|
373
|
+
def resolve_missing_keys(hash, options) # rubocop:disable Metrics/PerceivedComplexity
|
372
374
|
skip_missing = options.fetch(:skip_missing, false)
|
373
375
|
resolve_defaults = options.fetch(:resolve_defaults, true)
|
374
376
|
|
data/lib/dry/types/sum.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/types/options"
|
4
|
-
require "dry/types/meta"
|
5
|
-
|
6
3
|
module Dry
|
7
4
|
module Types
|
8
5
|
# Sum type
|
@@ -120,10 +117,10 @@ module Dry
|
|
120
117
|
|
121
118
|
# @api private
|
122
119
|
def failure(input, _error = nil)
|
123
|
-
if
|
124
|
-
left.failure(input, left.try(input).error)
|
125
|
-
else
|
120
|
+
if left.valid?(input)
|
126
121
|
right.failure(input, right.try(input).error)
|
122
|
+
else
|
123
|
+
left.failure(input, left.try(input).error)
|
127
124
|
end
|
128
125
|
end
|
129
126
|
|
data/lib/dry/types/type.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/deprecations"
|
4
|
-
|
5
3
|
module Dry
|
6
4
|
module Types
|
7
5
|
# Common Type module denoting an object is a Type
|
8
6
|
#
|
9
7
|
# @api public
|
10
8
|
module Type
|
11
|
-
extend ::Dry::Core::Deprecations[:
|
9
|
+
extend ::Dry::Core::Deprecations[:"dry-types"]
|
12
10
|
|
13
11
|
deprecate(:safe, :lax)
|
14
12
|
|
data/lib/dry/types/version.rb
CHANGED
data/lib/dry/types.rb
CHANGED
@@ -3,37 +3,58 @@
|
|
3
3
|
require "bigdecimal"
|
4
4
|
require "date"
|
5
5
|
require "set"
|
6
|
+
require "zeitwerk"
|
6
7
|
|
7
8
|
require "concurrent/map"
|
8
9
|
|
10
|
+
require "dry/core"
|
9
11
|
require "dry/container"
|
10
|
-
require "dry/
|
11
|
-
require "dry/core/constants"
|
12
|
-
require "dry/core/class_attributes"
|
13
|
-
|
14
|
-
require "dry/types/version"
|
15
|
-
require "dry/types/container"
|
16
|
-
require "dry/types/inflector"
|
17
|
-
require "dry/types/type"
|
18
|
-
require "dry/types/printable"
|
19
|
-
require "dry/types/nominal"
|
20
|
-
require "dry/types/constructor"
|
21
|
-
require "dry/types/module"
|
12
|
+
require "dry/logic"
|
22
13
|
|
14
|
+
require "dry/types/constraints"
|
23
15
|
require "dry/types/errors"
|
16
|
+
require "dry/types/version"
|
24
17
|
|
25
18
|
module Dry
|
26
19
|
# Main library namespace
|
27
20
|
#
|
28
21
|
# @api public
|
29
22
|
module Types
|
30
|
-
extend Dry::Core::Extensions
|
31
|
-
extend Dry::Core::ClassAttributes
|
32
|
-
extend Dry::Core::Deprecations[:
|
33
|
-
include Dry::Core::Constants
|
23
|
+
extend ::Dry::Core::Extensions
|
24
|
+
extend ::Dry::Core::ClassAttributes
|
25
|
+
extend ::Dry::Core::Deprecations[:"dry-types"]
|
26
|
+
include ::Dry::Core::Constants
|
34
27
|
|
35
28
|
TYPE_SPEC_REGEX = /(.+)<(.+)>/.freeze
|
36
29
|
|
30
|
+
def self.loader
|
31
|
+
@loader ||= ::Zeitwerk::Loader.new.tap do |loader|
|
32
|
+
root = ::File.expand_path("..", __dir__)
|
33
|
+
loader.tag = "dry-types"
|
34
|
+
loader.inflector = ::Zeitwerk::GemInflector.new("#{root}/dry-types.rb")
|
35
|
+
loader.inflector.inflect("json" => "JSON")
|
36
|
+
loader.push_dir(root)
|
37
|
+
loader.ignore(
|
38
|
+
"#{root}/dry-types.rb",
|
39
|
+
"#{root}/dry/types/extensions",
|
40
|
+
"#{root}/dry/types/spec/types.rb",
|
41
|
+
"#{root}/dry/types/{#{%w[
|
42
|
+
compat
|
43
|
+
constraints
|
44
|
+
core
|
45
|
+
errors
|
46
|
+
extensions
|
47
|
+
json
|
48
|
+
params
|
49
|
+
printer
|
50
|
+
version
|
51
|
+
].join(",")}}.rb"
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
loader.setup
|
57
|
+
|
37
58
|
# @see Dry.Types
|
38
59
|
def self.module(*namespaces, default: :nominal, **aliases)
|
39
60
|
::Module.new(container, *namespaces, default: default, **aliases)
|
@@ -180,7 +201,7 @@ module Dry
|
|
180
201
|
#
|
181
202
|
# module Types
|
182
203
|
# # imports all types as constants, uses modules for namespaces
|
183
|
-
# include Dry
|
204
|
+
# include Dry.Types()
|
184
205
|
# end
|
185
206
|
# # strict types are exported by default
|
186
207
|
# Types::Integer
|
@@ -191,7 +212,7 @@ module Dry
|
|
191
212
|
# @example changing default types
|
192
213
|
#
|
193
214
|
# module Types
|
194
|
-
# include Dry
|
215
|
+
# include Dry.Types(default: :nominal)
|
195
216
|
# end
|
196
217
|
# Types::Integer
|
197
218
|
# # => #<Dry::Types[Nominal<Integer>]>
|
@@ -199,7 +220,7 @@ module Dry
|
|
199
220
|
# @example cherry-picking namespaces
|
200
221
|
#
|
201
222
|
# module Types
|
202
|
-
# include Dry
|
223
|
+
# include Dry.Types(:strict, :coercible)
|
203
224
|
# end
|
204
225
|
# # cherry-picking discards default types,
|
205
226
|
# # provide the :default option along with the list of
|
@@ -208,7 +229,7 @@ module Dry
|
|
208
229
|
#
|
209
230
|
# @example custom names
|
210
231
|
# module Types
|
211
|
-
# include Dry
|
232
|
+
# include Dry.Types(coercible: :Kernel)
|
212
233
|
# end
|
213
234
|
# Types::Kernel::Integer
|
214
235
|
# # => #<Dry::Types[Constructor<Nominal<Integer> fn=Kernel.Integer>]>
|
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.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -44,20 +44,20 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.9'
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '0.
|
50
|
+
version: '0.9'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '0.
|
57
|
+
version: '0.9'
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.9'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: dry-inflector
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,20 +84,34 @@ dependencies:
|
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '1.
|
87
|
+
version: '1.3'
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.
|
90
|
+
version: '1.3'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '1.
|
97
|
+
version: '1.3'
|
98
98
|
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: 1.
|
100
|
+
version: '1.3'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: zeitwerk
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '2.6'
|
108
|
+
type: :runtime
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '2.6'
|
101
115
|
- !ruby/object:Gem::Dependency
|
102
116
|
name: bundler
|
103
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,7 +251,7 @@ licenses:
|
|
237
251
|
- MIT
|
238
252
|
metadata:
|
239
253
|
allowed_push_host: https://rubygems.org
|
240
|
-
changelog_uri: https://github.com/dry-rb/dry-types/blob/
|
254
|
+
changelog_uri: https://github.com/dry-rb/dry-types/blob/main/CHANGELOG.md
|
241
255
|
source_code_uri: https://github.com/dry-rb/dry-types
|
242
256
|
bug_tracker_uri: https://github.com/dry-rb/dry-types/issues
|
243
257
|
post_install_message:
|
@@ -248,14 +262,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
262
|
requirements:
|
249
263
|
- - ">="
|
250
264
|
- !ruby/object:Gem::Version
|
251
|
-
version: 2.
|
265
|
+
version: 2.7.0
|
252
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
267
|
requirements:
|
254
268
|
- - ">="
|
255
269
|
- !ruby/object:Gem::Version
|
256
270
|
version: '0'
|
257
271
|
requirements: []
|
258
|
-
rubygems_version: 3.1.
|
272
|
+
rubygems_version: 3.1.6
|
259
273
|
signing_key:
|
260
274
|
specification_version: 4
|
261
275
|
summary: Type system for Ruby supporting coercions, constraints and complex types
|