dry-types 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/dry/types/module.rb +7 -3
- data/lib/dry/types/version.rb +1 -1
- data/lib/dry/types.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4ee8c4beedab353a6e3998fb6bf9bfe5cc61989acede9bb9dd5f5f1005d92d3
|
4
|
+
data.tar.gz: 1814b031b9e3de53b1a6162da3935bae8dacd04826e158b91dbcd32f367c9078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5ab795414ca2f9ffa143e274dd7b9c606a923038422d72ebe996b20e37ff3bac29d994cf59d60d2ab6dc22e70378f461b414f945c598e8cbb7d2ece93912035
|
7
|
+
data.tar.gz: 5d482e5ffb8e3ec65e2651b07bb430bf596dc3cfa8bff91f8342bb332f844dbb2d083a9eb2bfdcc70c9d5785731806319c424695560d4a2713d8445d338ab5ea
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 1.6.1 2022-10-15
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
|
8
|
+
- Fix issues with internal const_missing and Inflector/Module constants (@flash-gordon + @solnic)
|
9
|
+
|
10
|
+
[Compare v1.6.0...v1.6.1](https://github.com/dry-rb/dry-types/compare/v1.6.0...v1.6.1)
|
11
|
+
|
3
12
|
## 1.6.0 2022-10-15
|
4
13
|
|
5
14
|
|
data/lib/dry/types/module.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "dry/types/builder_methods"
|
4
|
+
|
3
5
|
module Dry
|
4
6
|
module Types
|
5
7
|
# Export types registered in a container as module constants.
|
@@ -44,7 +46,7 @@ module Dry
|
|
44
46
|
elsif Undefined.equal?(default)
|
45
47
|
default_ns = Undefined
|
46
48
|
else
|
47
|
-
default_ns = Inflector.camelize(default).to_sym
|
49
|
+
default_ns = Types::Inflector.camelize(default).to_sym
|
48
50
|
end
|
49
51
|
|
50
52
|
tree = registry_tree
|
@@ -52,7 +54,9 @@ module Dry
|
|
52
54
|
if namespaces.empty? && aliases.empty?
|
53
55
|
modules = tree.select { |_, v| v.is_a?(::Hash) }.map(&:first)
|
54
56
|
else
|
55
|
-
modules = (namespaces + aliases.keys).map { |n|
|
57
|
+
modules = (namespaces + aliases.keys).map { |n|
|
58
|
+
Types::Inflector.camelize(n).to_sym
|
59
|
+
}
|
56
60
|
end
|
57
61
|
|
58
62
|
tree.each_with_object({}) do |(key, value), constants|
|
@@ -73,7 +77,7 @@ module Dry
|
|
73
77
|
@registry_tree ||= @registry.keys.each_with_object({}) { |key, tree|
|
74
78
|
type = @registry[key]
|
75
79
|
*modules, const_name = key.split(".").map { |part|
|
76
|
-
Inflector.camelize(part).to_sym
|
80
|
+
Types::Inflector.camelize(part).to_sym
|
77
81
|
}
|
78
82
|
next if modules.empty?
|
79
83
|
|
data/lib/dry/types/version.rb
CHANGED
data/lib/dry/types.rb
CHANGED
@@ -15,6 +15,10 @@ require "dry/types/constraints"
|
|
15
15
|
require "dry/types/errors"
|
16
16
|
require "dry/types/version"
|
17
17
|
|
18
|
+
# This must be required explicitly as it may conflict with dry-inflector
|
19
|
+
require "dry/types/inflector"
|
20
|
+
require "dry/types/module"
|
21
|
+
|
18
22
|
module Dry
|
19
23
|
# Main library namespace
|
20
24
|
#
|
@@ -44,6 +48,8 @@ module Dry
|
|
44
48
|
core
|
45
49
|
errors
|
46
50
|
extensions
|
51
|
+
inflector
|
52
|
+
module
|
47
53
|
json
|
48
54
|
params
|
49
55
|
printer
|
@@ -141,7 +147,7 @@ module Dry
|
|
141
147
|
#
|
142
148
|
# @return [String]
|
143
149
|
def self.identifier(klass)
|
144
|
-
Inflector.underscore(klass).tr("/", ".")
|
150
|
+
Types::Inflector.underscore(klass).tr("/", ".")
|
145
151
|
end
|
146
152
|
|
147
153
|
# Cached type map
|
@@ -155,7 +161,7 @@ module Dry
|
|
155
161
|
|
156
162
|
# @api private
|
157
163
|
def self.const_missing(const)
|
158
|
-
underscored = Inflector.underscore(const)
|
164
|
+
underscored = Types::Inflector.underscore(const)
|
159
165
|
|
160
166
|
if container.keys.any? { |key| key.split(".")[0] == underscored }
|
161
167
|
raise ::NameError,
|