dry-schema 1.13.4 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -1
  4. data/config/errors.yml +9 -1
  5. data/dry-schema.gemspec +15 -17
  6. data/lib/dry/schema/config.rb +6 -6
  7. data/lib/dry/schema/constants.rb +2 -2
  8. data/lib/dry/schema/dsl.rb +18 -18
  9. data/lib/dry/schema/extensions/hints/message_compiler_methods.rb +1 -1
  10. data/lib/dry/schema/extensions/info/schema_compiler.rb +16 -7
  11. data/lib/dry/schema/extensions/json_schema/schema_compiler.rb +3 -3
  12. data/lib/dry/schema/extensions/monads.rb +1 -1
  13. data/lib/dry/schema/extensions/struct.rb +3 -3
  14. data/lib/dry/schema/key.rb +4 -4
  15. data/lib/dry/schema/key_coercer.rb +3 -3
  16. data/lib/dry/schema/key_map.rb +5 -5
  17. data/lib/dry/schema/key_validator.rb +19 -8
  18. data/lib/dry/schema/macros/dsl.rb +8 -8
  19. data/lib/dry/schema/macros/each.rb +2 -2
  20. data/lib/dry/schema/macros/filled.rb +4 -5
  21. data/lib/dry/schema/macros/hash.rb +2 -2
  22. data/lib/dry/schema/macros/maybe.rb +2 -2
  23. data/lib/dry/schema/macros/schema.rb +3 -3
  24. data/lib/dry/schema/macros/value.rb +12 -12
  25. data/lib/dry/schema/message.rb +4 -4
  26. data/lib/dry/schema/message_compiler.rb +8 -8
  27. data/lib/dry/schema/message_set.rb +8 -8
  28. data/lib/dry/schema/messages/abstract.rb +12 -12
  29. data/lib/dry/schema/messages/namespaced.rb +1 -1
  30. data/lib/dry/schema/messages/template.rb +2 -2
  31. data/lib/dry/schema/messages/yaml.rb +3 -3
  32. data/lib/dry/schema/path.rb +12 -12
  33. data/lib/dry/schema/predicate.rb +4 -4
  34. data/lib/dry/schema/predicate_registry.rb +2 -2
  35. data/lib/dry/schema/processor.rb +10 -10
  36. data/lib/dry/schema/processor_steps.rb +1 -1
  37. data/lib/dry/schema/result.rb +6 -6
  38. data/lib/dry/schema/rule_applier.rb +1 -1
  39. data/lib/dry/schema/trace.rb +1 -1
  40. data/lib/dry/schema/type_container.rb +2 -2
  41. data/lib/dry/schema/type_registry.rb +1 -1
  42. data/lib/dry/schema/types.rb +1 -1
  43. data/lib/dry/schema/types_merger.rb +18 -62
  44. data/lib/dry/schema/value_coercer.rb +1 -1
  45. data/lib/dry/schema/version.rb +1 -1
  46. data/lib/dry/schema.rb +11 -11
  47. metadata +20 -78
@@ -11,7 +11,7 @@ module Dry
11
11
  def call(*args, &block)
12
12
  super(*args, &nil) unless args.empty?
13
13
 
14
- if args.size.equal?(1) && (op = args.first).is_a?(Dry::Logic::Operations::Abstract)
14
+ if args.size.equal?(1) && (op = args.first).is_a?(::Dry::Logic::Operations::Abstract)
15
15
  process_operation(op)
16
16
  end
17
17
 
@@ -55,8 +55,8 @@ module Dry
55
55
 
56
56
  # @api private
57
57
  # rubocop: disable Metrics/AbcSize
58
- def define(*args, &block)
59
- definition = schema_dsl.new(path: schema_dsl.path, &block)
58
+ def define(*args, &)
59
+ definition = schema_dsl.new(path: schema_dsl.path, &)
60
60
  schema = definition.call
61
61
  type_schema =
62
62
  if array_type?(parent_type)
@@ -12,11 +12,11 @@ module Dry
12
12
  # rubocop:disable Metrics/AbcSize
13
13
  # rubocop:disable Metrics/CyclomaticComplexity
14
14
  # rubocop:disable Metrics/PerceivedComplexity
15
- def call(*args, **opts, &block)
16
- types, predicates = args.partition { |arg| arg.is_a?(Dry::Types::Type) }
15
+ def call(*args, **opts, &)
16
+ types, predicates = args.partition { _1.is_a?(::Dry::Types::Type) }
17
17
 
18
- constructor = types.select { |type| type.is_a?(Dry::Types::Constructor) }.reduce(:>>)
19
- schema = predicates.detect { |predicate| predicate.is_a?(Processor) }
18
+ constructor = types.select { _1.is_a?(::Dry::Types::Constructor) }.reduce(:>>)
19
+ schema = predicates.detect { _1.is_a?(Processor) }
20
20
 
21
21
  schema_dsl.set_type(name, constructor) if constructor
22
22
 
@@ -41,20 +41,20 @@ module Dry
41
41
  end
42
42
  end
43
43
 
44
- trace_opts = opts.reject { |key, _| %i[type_spec type_rule].include?(key) }
44
+ trace_opts = opts.except(:type_spec, :type_rule)
45
45
 
46
46
  if (type_rule = opts[:type_rule])
47
47
  trace.append(type_rule).evaluate(*predicates, **trace_opts)
48
- trace.append(new(chain: false).instance_exec(&block)) if block
48
+ trace.append(new(chain: false).instance_exec(&)) if block_given?
49
49
  else
50
50
  trace.evaluate(*predicates, **trace_opts)
51
51
 
52
- if block && type_spec.equal?(:hash)
53
- hash(&block)
52
+ if block_given? && type_spec.equal?(:hash)
53
+ hash(&)
54
54
  elsif type_spec.is_a?(::Dry::Types::Type) && hash_type?(type_spec)
55
55
  hash(type_spec)
56
- elsif block
57
- trace.append(new(chain: false).instance_exec(&block))
56
+ elsif block_given?
57
+ trace.append(new(chain: false).instance_exec(&))
58
58
  end
59
59
  end
60
60
 
@@ -112,9 +112,9 @@ module Dry
112
112
  private
113
113
 
114
114
  # @api private
115
- def method_missing(meth, *args, &block)
115
+ def method_missing(meth, ...)
116
116
  if meth.to_s.end_with?(QUESTION_MARK)
117
- trace.__send__(meth, *args, &block)
117
+ trace.__send__(meth, ...)
118
118
  else
119
119
  super
120
120
  end
@@ -8,9 +8,9 @@ module Dry
8
8
  #
9
9
  # @api public
10
10
  class Message
11
- include Dry::Equalizer(:text, :path, :predicate, :input)
11
+ include ::Dry::Equalizer(:text, :path, :predicate, :input)
12
12
 
13
- extend Dry::Initializer
13
+ extend ::Dry::Initializer
14
14
 
15
15
  # @!attribute [r] text
16
16
  # Message text representation created from a localized template
@@ -75,7 +75,7 @@ module Dry
75
75
  #
76
76
  # @api private
77
77
  def eql?(other)
78
- other.is_a?(String) ? text == other : super
78
+ other.is_a?(::String) ? text == other : super
79
79
  end
80
80
 
81
81
  # @api private
@@ -94,7 +94,7 @@ module Dry
94
94
  r_path = other._path
95
95
 
96
96
  unless l_path.same_root?(r_path)
97
- raise ArgumentError, "Cannot compare messages from different root paths"
97
+ raise ::ArgumentError, "Cannot compare messages from different root paths"
98
98
  end
99
99
 
100
100
  l_path <=> r_path
@@ -9,7 +9,7 @@ module Dry
9
9
  #
10
10
  # @api private
11
11
  class MessageCompiler
12
- extend Dry::Initializer
12
+ extend ::Dry::Initializer
13
13
 
14
14
  resolve_key_predicate = proc { |node, opts|
15
15
  *arg_vals, val = node.map(&:last)
@@ -20,12 +20,12 @@ module Dry
20
20
  [Array(opts.path), *node.map(&:last)]
21
21
  }
22
22
 
23
- DEFAULT_PREDICATE_RESOLVERS = Hash
23
+ DEFAULT_PREDICATE_RESOLVERS = ::Hash
24
24
  .new(resolve_predicate).update(key?: resolve_key_predicate).freeze
25
25
 
26
26
  EMPTY_OPTS = VisitorOpts.new
27
27
  EMPTY_MESSAGE_SET = MessageSet.new(EMPTY_ARRAY).freeze
28
- FULL_MESSAGE_WHITESPACE = Hash.new(" ").merge(
28
+ FULL_MESSAGE_WHITESPACE = ::Hash.new(" ").merge(
29
29
  ja: "",
30
30
  zh: "",
31
31
  bn: "",
@@ -190,7 +190,7 @@ module Dry
190
190
  def lookup_options(arg_vals:, input:)
191
191
  default_lookup_options.merge(
192
192
  arg_type: arg_vals.size == 1 && arg_vals[0].class,
193
- val_type: input.equal?(Undefined) ? NilClass : input.class
193
+ val_type: input.equal?(Undefined) ? ::NilClass : input.class
194
194
  )
195
195
  end
196
196
 
@@ -209,11 +209,11 @@ module Dry
209
209
  def message_tokens(args)
210
210
  tokens = args.each_with_object({}) do |arg, hash|
211
211
  case arg[1]
212
- when Array
212
+ when ::Array, ::Set
213
213
  hash[arg[0]] = arg[1].join(LIST_SEPARATOR)
214
- when Range
215
- hash["#{arg[0]}_left".to_sym] = arg[1].first
216
- hash["#{arg[0]}_right".to_sym] = arg[1].last
214
+ when ::Range
215
+ hash[:"#{arg[0]}_left"] = arg[1].first
216
+ hash[:"#{arg[0]}_right"] = arg[1].last
217
217
  else
218
218
  hash[arg[0]] = arg[1]
219
219
  end
@@ -10,8 +10,8 @@ module Dry
10
10
  #
11
11
  # @api public
12
12
  class MessageSet
13
- include Enumerable
14
- include Dry::Equalizer(:messages, :options)
13
+ include ::Enumerable
14
+ include ::Dry::Equalizer(:messages, :options)
15
15
 
16
16
  # A list of compiled message objects
17
17
  #
@@ -44,11 +44,11 @@ module Dry
44
44
  # @return [Array]
45
45
  #
46
46
  # @api public
47
- def each(&block)
47
+ def each(&)
48
48
  return self if empty?
49
- return to_enum unless block
49
+ return to_enum unless block_given?
50
50
 
51
- messages.each(&block)
51
+ messages.each(&)
52
52
  end
53
53
 
54
54
  # Dump message set to a hash
@@ -82,7 +82,7 @@ module Dry
82
82
  #
83
83
  # @api public
84
84
  def fetch(key)
85
- self[key] || raise(KeyError, "+#{key}+ message was not found")
85
+ self[key] || raise(::KeyError, "+#{key}+ message was not found")
86
86
  end
87
87
 
88
88
  # Check if a message set is empty
@@ -135,9 +135,9 @@ module Dry
135
135
  # @api private
136
136
  def partition_message_values(values)
137
137
  values
138
- .map { |value| value.is_a?(Array) ? value : [value] }
138
+ .map { |value| value.is_a?(::Array) ? value : [value] }
139
139
  .reduce(EMPTY_ARRAY.dup, :+)
140
- .partition { |value| value.is_a?(Hash) && !value[:text].is_a?(String) }
140
+ .partition { |value| value.is_a?(::Hash) && !value[:text].is_a?(::String) }
141
141
  end
142
142
  end
143
143
  end
@@ -12,11 +12,11 @@ module Dry
12
12
  #
13
13
  # @api public
14
14
  class Abstract
15
- include Dry::Configurable
16
- include Dry::Equalizer(:config)
15
+ include ::Dry::Configurable
16
+ include ::Dry::Equalizer(:config)
17
17
 
18
18
  setting :default_locale
19
- setting :load_paths, default: Set[DEFAULT_MESSAGES_PATH]
19
+ setting :load_paths, default: ::Set[DEFAULT_MESSAGES_PATH]
20
20
  setting :top_namespace, default: DEFAULT_MESSAGES_ROOT
21
21
  setting :root, default: "errors"
22
22
  setting :lookup_options, default: %i[root predicate path val_type arg_type].freeze
@@ -34,13 +34,13 @@ module Dry
34
34
 
35
35
  setting :rule_lookup_paths, default: ["rules.%<name>s"].freeze
36
36
 
37
- setting :arg_types, default: Hash.new { |*| "default" }.update(
38
- Range => "range"
37
+ setting :arg_types, default: ::Hash.new { |*| "default" }.update(
38
+ ::Range => "range"
39
39
  )
40
40
 
41
- setting :val_types, default: Hash.new { |*| "default" }.update(
42
- Range => "range",
43
- String => "string"
41
+ setting :val_types, default: ::Hash.new { |*| "default" }.update(
42
+ ::Range => "range",
43
+ ::String => "string"
44
44
  )
45
45
 
46
46
  # @api private
@@ -80,7 +80,7 @@ module Dry
80
80
  path = rule_lookup_paths(tokens).detect { |key| key?(key, options) }
81
81
 
82
82
  rule = get(path, options) if path
83
- rule.is_a?(Hash) ? rule[:text] : rule
83
+ rule.is_a?(::Hash) ? rule[:text] : rule
84
84
  end
85
85
 
86
86
  # Retrieve a message template
@@ -115,7 +115,7 @@ module Dry
115
115
  #
116
116
  # @api public
117
117
  def key?(_key, _options = EMPTY_HASH)
118
- raise NotImplementedError
118
+ raise ::NotImplementedError
119
119
  end
120
120
 
121
121
  # Retrieve an array of looked up paths
@@ -172,12 +172,12 @@ module Dry
172
172
 
173
173
  # @api private
174
174
  def interpolatable_data(_key, _options, **_data)
175
- raise NotImplementedError
175
+ raise ::NotImplementedError
176
176
  end
177
177
 
178
178
  # @api private
179
179
  def interpolate(_key, _options, **_data)
180
- raise NotImplementedError
180
+ raise ::NotImplementedError
181
181
  end
182
182
 
183
183
  private
@@ -6,7 +6,7 @@ module Dry
6
6
  # Namespaced messages backend
7
7
  #
8
8
  # @api public
9
- class Namespaced < Dry::Schema::Messages::Abstract
9
+ class Namespaced < ::Dry::Schema::Messages::Abstract
10
10
  # @api private
11
11
  attr_reader :namespace
12
12
 
@@ -10,8 +10,8 @@ module Dry
10
10
  module Messages
11
11
  # @api private
12
12
  class Template
13
- extend Dry::Initializer
14
- include Dry::Equalizer(:messages, :key, :options)
13
+ extend ::Dry::Initializer
14
+ include ::Dry::Equalizer(:messages, :key, :options)
15
15
 
16
16
  option :messages
17
17
  option :key
@@ -14,7 +14,7 @@ module Dry
14
14
  class YAML < Abstract
15
15
  LOCALE_TOKEN = "%<locale>s"
16
16
  TOKEN_REGEXP = /%{(\w*)}/
17
- EMPTY_CONTEXT = Object.new.tap { |ctx|
17
+ EMPTY_CONTEXT = ::Object.new.tap { |ctx|
18
18
  def ctx.context
19
19
  binding
20
20
  end
@@ -165,12 +165,12 @@ module Dry
165
165
  # @api private
166
166
  def evaluation_context(key, options)
167
167
  cache.fetch_or_store(get(key, options).fetch(:text)) do |input|
168
- tokens = input.scan(TOKEN_REGEXP).flatten(1).map(&:to_sym).to_set
168
+ tokens = input.scan(TOKEN_REGEXP).flatten(1).to_set(&:to_sym)
169
169
  text = input.gsub("%", "#")
170
170
 
171
171
  # rubocop:disable Security/Eval
172
172
  evaluator = eval(<<~RUBY, EMPTY_CONTEXT, __FILE__, __LINE__ + 1)
173
- -> (#{tokens.map { |token| "#{token}:" }.join(", ")}) { "#{text}" }
173
+ -> (#{tokens.map { |token| "#{token}:" }.join(", ")}) { "#{text}" } # -> (a:, b:) { "Translation #\{a} #\{b}" }
174
174
  RUBY
175
175
  # rubocop:enable Security/Eval
176
176
 
@@ -8,9 +8,9 @@ module Dry
8
8
  #
9
9
  # @api private
10
10
  class Path
11
- include Dry.Equalizer(:keys)
12
- include Comparable
13
- include Enumerable
11
+ include ::Dry.Equalizer(:keys)
12
+ include ::Comparable
13
+ include ::Enumerable
14
14
 
15
15
  # @return [Array<Symbol>]
16
16
  attr_reader :keys
@@ -26,16 +26,16 @@ module Dry
26
26
  # @api private
27
27
  def self.call(spec)
28
28
  case spec
29
- when Symbol, Array
30
- new(Array[*spec])
31
- when String
29
+ when ::Symbol, ::Array
30
+ new([*spec])
31
+ when ::String
32
32
  new(spec.split(DOT).map(&:to_sym))
33
- when Hash
33
+ when ::Hash
34
34
  new(keys_from_hash(spec))
35
35
  when self
36
36
  spec
37
37
  else
38
- raise ArgumentError, "+spec+ must be either a Symbol, Array, Hash or a #{name}"
38
+ raise ::ArgumentError, "+spec+ must be either a Symbol, Array, Hash or a #{name}"
39
39
  end
40
40
  end
41
41
 
@@ -49,7 +49,7 @@ module Dry
49
49
  # @api private
50
50
  def self.keys_from_hash(hash)
51
51
  hash.inject([]) { |a, (k, v)|
52
- v.is_a?(Hash) ? a.concat([k, *keys_from_hash(v)]) : a.concat([k, v])
52
+ v.is_a?(::Hash) ? a.push(k, *keys_from_hash(v)) : a.push(k, v)
53
53
  }
54
54
  end
55
55
 
@@ -60,14 +60,14 @@ module Dry
60
60
 
61
61
  # @api private
62
62
  def to_h(value = EMPTY_ARRAY.dup)
63
- value = [value] unless value.is_a?(Array)
63
+ value = [value] unless value.is_a?(::Array)
64
64
 
65
65
  keys.reverse_each.reduce(value) { |result, key| {key => result} }
66
66
  end
67
67
 
68
68
  # @api private
69
- def each(&block)
70
- keys.each(&block)
69
+ def each(&)
70
+ keys.each(&)
71
71
  end
72
72
 
73
73
  # @api private
@@ -13,7 +13,7 @@ module Dry
13
13
  #
14
14
  # @api private
15
15
  class Negation
16
- include Dry::Logic::Operators
16
+ include ::Dry::Logic::Operators
17
17
 
18
18
  # @api private
19
19
  attr_reader :predicate
@@ -34,8 +34,8 @@ module Dry
34
34
  alias_method :ast, :to_ast
35
35
  end
36
36
 
37
- include Dry::Logic::Operators
38
- include Dry::Equalizer(:name, :args, :block)
37
+ include ::Dry::Logic::Operators
38
+ include ::Dry::Equalizer(:name, :args, :block)
39
39
 
40
40
  # @api private
41
41
  attr_reader :compiler
@@ -77,7 +77,7 @@ module Dry
77
77
  # @api private
78
78
  def ensure_valid
79
79
  if arity - 1 != args.size
80
- raise ArgumentError, "#{name} predicate arity is invalid"
80
+ raise ::ArgumentError, "#{name} predicate arity is invalid"
81
81
  end
82
82
  end
83
83
 
@@ -5,7 +5,7 @@ module Dry
5
5
  # A registry with predicate objects from `Dry::Logic::Predicates`
6
6
  #
7
7
  # @api private
8
- class PredicateRegistry < Dry::Types::PredicateRegistry
8
+ class PredicateRegistry < ::Dry::Types::PredicateRegistry
9
9
  # @api private
10
10
  def arg_list(name, *values)
11
11
  predicate = self[name]
@@ -15,7 +15,7 @@ module Dry
15
15
  predicate
16
16
  .parameters
17
17
  .map(&:last)
18
- .zip(values + Array.new(arity - values.size, Undefined))
18
+ .zip(values + ::Array.new(arity - values.size, Undefined))
19
19
  end
20
20
  end
21
21
  end
@@ -13,10 +13,10 @@ module Dry
13
13
  #
14
14
  # @api public
15
15
  class Processor
16
- extend Dry::Initializer
17
- extend Dry::Configurable
16
+ extend ::Dry::Initializer
17
+ extend ::Dry::Configurable
18
18
 
19
- include Dry::Logic::Operators
19
+ include ::Dry::Logic::Operators
20
20
 
21
21
  setting :key_map_type
22
22
  setting :type_registry_namespace, default: :strict
@@ -42,9 +42,9 @@ module Dry
42
42
  # @return [Class]
43
43
  #
44
44
  # @api public
45
- def define(&block)
45
+ def define(&)
46
46
  @definition ||= DSL.new(
47
- processor_type: self, parent: superclass.definition, **config.to_h, &block
47
+ processor_type: self, parent: superclass.definition, **config.to_h, &
48
48
  )
49
49
  self
50
50
  end
@@ -54,15 +54,15 @@ module Dry
54
54
  # @return [Processor]
55
55
  #
56
56
  # @api public
57
- def new(options = nil, &block)
58
- if options || block
57
+ def new(options = nil)
58
+ if options || block_given?
59
59
  processor = super(**(options || EMPTY_HASH))
60
- yield(processor) if block
60
+ yield(processor) if block_given?
61
61
  processor
62
62
  elsif definition
63
63
  definition.call
64
64
  else
65
- raise ArgumentError, "Cannot create a schema without a definition"
65
+ raise ::ArgumentError, "Cannot create a schema without a definition"
66
66
  end
67
67
  end
68
68
  end
@@ -83,7 +83,7 @@ module Dry
83
83
 
84
84
  # @api public
85
85
  def xor(_other)
86
- raise NotImplementedError, "composing schemas using `xor` operator is not supported yet"
86
+ raise ::NotImplementedError, "composing schemas using `xor` operator is not supported yet"
87
87
  end
88
88
  alias_method :^, :xor
89
89
 
@@ -19,7 +19,7 @@ module Dry
19
19
  #
20
20
  # @api public
21
21
  class ProcessorSteps
22
- extend Dry::Initializer
22
+ extend ::Dry::Initializer
23
23
 
24
24
  option :steps, default: -> { EMPTY_HASH.dup }
25
25
  option :before_steps, default: -> { EMPTY_HASH.dup }
@@ -11,9 +11,9 @@ module Dry
11
11
  #
12
12
  # @api public
13
13
  class Result
14
- include Dry::Equalizer(:output, :errors)
14
+ include ::Dry::Equalizer(:output, :errors)
15
15
 
16
- extend Dry::Initializer[undefined: false]
16
+ extend ::Dry::Initializer[undefined: false]
17
17
 
18
18
  # @api private
19
19
  param :output, reader: false
@@ -43,18 +43,18 @@ module Dry
43
43
  # @return [Result]
44
44
  #
45
45
  # @api private
46
- def at(at_path, &block)
47
- new(@output, path: Path.new([*path, *Path[at_path]]), &block)
46
+ def at(at_path, &)
47
+ new(@output, path: Path.new([*path, *Path[at_path]]), &)
48
48
  end
49
49
 
50
50
  # @api private
51
- def new(output, **opts, &block)
51
+ def new(output, **opts, &)
52
52
  self.class.new(
53
53
  output,
54
54
  message_compiler: message_compiler,
55
55
  result_ast: result_ast,
56
56
  **opts,
57
- &block
57
+ &
58
58
  )
59
59
  end
60
60
 
@@ -9,7 +9,7 @@ module Dry
9
9
  #
10
10
  # @api private
11
11
  class RuleApplier
12
- extend Dry::Initializer
12
+ extend ::Dry::Initializer
13
13
 
14
14
  # @api private
15
15
  param :rules
@@ -5,7 +5,7 @@ module Dry
5
5
  # Captures predicates defined within the DSL
6
6
  #
7
7
  # @api private
8
- class Trace < BasicObject
8
+ class Trace < ::BasicObject
9
9
  INVALID_PREDICATES = %i[key?].freeze
10
10
 
11
11
  include ::Dry::Equalizer(:compiler, :captures)
@@ -13,9 +13,9 @@ module Dry
13
13
  #
14
14
  # @api public
15
15
  class TypeContainer
16
- include Dry::Core::Container::Mixin
16
+ include ::Dry::Core::Container::Mixin
17
17
 
18
- def initialize(types_container = Dry::Types.container)
18
+ def initialize(types_container = ::Dry::Types.container)
19
19
  super()
20
20
 
21
21
  merge(types_container)
@@ -18,7 +18,7 @@ module Dry
18
18
  attr_reader :namespace
19
19
 
20
20
  # @api private
21
- def self.new(types = Dry::Types, namespace = :strict)
21
+ def self.new(types = ::Dry::Types, namespace = :strict)
22
22
  super
23
23
  end
24
24
 
@@ -8,7 +8,7 @@ module Dry
8
8
  #
9
9
  # @api public
10
10
  module Types
11
- include Dry.Types
11
+ include ::Dry.Types
12
12
  end
13
13
  end
14
14
  end