dry-types 1.7.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +1 -1
  4. data/dry-types.gemspec +12 -16
  5. data/lib/dry/types/any.rb +3 -9
  6. data/lib/dry/types/array/constructor.rb +3 -9
  7. data/lib/dry/types/array/member.rb +1 -3
  8. data/lib/dry/types/array.rb +1 -1
  9. data/lib/dry/types/builder.rb +19 -35
  10. data/lib/dry/types/builder_methods.rb +5 -15
  11. data/lib/dry/types/coercions/json.rb +3 -3
  12. data/lib/dry/types/coercions/params.rb +13 -13
  13. data/lib/dry/types/coercions.rb +13 -15
  14. data/lib/dry/types/compiler.rb +5 -7
  15. data/lib/dry/types/composition.rb +17 -31
  16. data/lib/dry/types/constrained.rb +31 -23
  17. data/lib/dry/types/constructor/function.rb +19 -31
  18. data/lib/dry/types/constructor/wrapper.rb +5 -11
  19. data/lib/dry/types/constructor.rb +9 -17
  20. data/lib/dry/types/core.rb +14 -6
  21. data/lib/dry/types/decorator.rb +7 -18
  22. data/lib/dry/types/default.rb +12 -16
  23. data/lib/dry/types/enum.rb +33 -13
  24. data/lib/dry/types/errors.rb +4 -8
  25. data/lib/dry/types/extensions/maybe.rb +4 -10
  26. data/lib/dry/types/fn_container.rb +3 -3
  27. data/lib/dry/types/hash/constructor.rb +3 -9
  28. data/lib/dry/types/hash.rb +8 -6
  29. data/lib/dry/types/implication.rb +3 -5
  30. data/lib/dry/types/inflector.rb +1 -1
  31. data/lib/dry/types/intersection.rb +3 -9
  32. data/lib/dry/types/lax.rb +4 -10
  33. data/lib/dry/types/map.rb +33 -41
  34. data/lib/dry/types/meta.rb +2 -6
  35. data/lib/dry/types/module.rb +3 -5
  36. data/lib/dry/types/nominal.rb +13 -35
  37. data/lib/dry/types/predicate_inferrer.rb +3 -5
  38. data/lib/dry/types/predicate_registry.rb +1 -3
  39. data/lib/dry/types/primitive_inferrer.rb +4 -12
  40. data/lib/dry/types/printable.rb +1 -3
  41. data/lib/dry/types/printer/composition.rb +3 -3
  42. data/lib/dry/types/printer.rb +6 -9
  43. data/lib/dry/types/result.rb +5 -15
  44. data/lib/dry/types/schema/key.rb +11 -26
  45. data/lib/dry/types/schema.rb +10 -12
  46. data/lib/dry/types/spec/types.rb +2 -2
  47. data/lib/dry/types/sum.rb +4 -8
  48. data/lib/dry/types/type.rb +2 -2
  49. data/lib/dry/types/version.rb +1 -1
  50. data/lib/dry/types.rb +2 -2
  51. metadata +8 -63
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12b751a4799c67217dd1540dacc45a70ce51dab53441ec64e575f74a520e0eb6
4
- data.tar.gz: e50e85513f68af8f0b98f5af707c2e82826c7daed237fba9ca014b96fc4e4754
3
+ metadata.gz: 506bb7b5eca44ddc06b248c28598dd58987cce24039e5991e7d659f41bed2235
4
+ data.tar.gz: 363581b2882f4cc03844b9e78e2211b3ff6af0304ac5b122e64d7ef5e4c39271
5
5
  SHA512:
6
- metadata.gz: c7247fc6a64c97967a83de7613f298d25137c4d03ae9afa79929255cca792dcb6a9f7203f4cdefb942b662c7ec7a32d0386a005c8e6e19ecfa03d37d802d2877
7
- data.tar.gz: 2a54fd10714b4a5a74e7026de501c9a74f4378890ed4e39f98f9b163eb23ebfd28d27d85165e18a68aa8603149df2c8d56eabef99f36d26c56f6e60676fa3e3b
6
+ metadata.gz: 70288750b129718df5082fd50a921250771c1c3d677ad673c0ca5a5f142b141ddd1804c25aeb8e7ec3fff59238ad12b8447eaa655cda6d5b79d499af7581bee9
7
+ data.tar.gz: 190559f11fc01b46dcd419607ca8ae707681aba95843c76132d63c0a78b7ebc4037ee331b59a04f9c771b81dc8956b41cb13473a8ce224eaca8311351ca9ac02
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 1.8.0 2025-01-06
4
+
5
+
6
+ ### Added
7
+
8
+ - Added `Enum#each_value` to iterate over enum values (@CharlieWWW94 in #471)
9
+
10
+ ### Fixed
11
+
12
+ - Fixed `Default#try` to return correct result (@elcuervo + @flash-gordon in #475)
13
+
14
+ ### Changed
15
+
16
+ - Set min Ruby version to 3.1 (@flash-gordon)
17
+ - Better representation of Enum types (@flash-gordon, see #460)
18
+
19
+ [Compare v1.7.2...v1.8.0](https://github.com/dry-rb/dry-types/compare/v1.7.2...v1.8.0)
20
+
3
21
  ## 1.7.2 2024-01-05
4
22
 
5
23
 
data/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  This library officially supports the following Ruby versions:
17
17
 
18
- * MRI `>= 3.0`
18
+ * MRI `>= 3.1`
19
19
  * jruby `>= 9.4` (not tested on CI)
20
20
 
21
21
  ## License
data/dry-types.gemspec CHANGED
@@ -21,23 +21,19 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = []
22
22
  spec.require_paths = ["lib"]
23
23
 
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"
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"
28
+ spec.metadata["rubygems_mfa_required"] = "true"
28
29
 
29
- spec.required_ruby_version = ">= 3.0"
30
+ spec.required_ruby_version = ">= 3.1"
30
31
 
31
32
  # to update dependencies edit project.yml
32
- spec.add_runtime_dependency "bigdecimal", "~> 3.0"
33
- spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
34
- spec.add_runtime_dependency "dry-core", "~> 1.0"
35
- spec.add_runtime_dependency "dry-inflector", "~> 1.0"
36
- spec.add_runtime_dependency "dry-logic", "~> 1.4"
37
- spec.add_runtime_dependency "zeitwerk", "~> 2.6"
38
-
39
- spec.add_development_dependency "bundler"
40
- spec.add_development_dependency "rake"
41
- spec.add_development_dependency "rspec"
42
- spec.add_development_dependency "yard"
33
+ spec.add_dependency "bigdecimal", "~> 3.0"
34
+ spec.add_dependency "concurrent-ruby", "~> 1.0"
35
+ spec.add_dependency "dry-core", "~> 1.0"
36
+ spec.add_dependency "dry-inflector", "~> 1.0"
37
+ spec.add_dependency "dry-logic", "~> 1.4"
38
+ spec.add_dependency "zeitwerk", "~> 2.6"
43
39
  end
data/lib/dry/types/any.rb CHANGED
@@ -9,9 +9,7 @@ module Dry
9
9
  #
10
10
  # @api public
11
11
  class AnyClass < Nominal
12
- def self.name
13
- "Any"
14
- end
12
+ def self.name = "Any"
15
13
 
16
14
  # @api private
17
15
  def initialize(**options)
@@ -21,9 +19,7 @@ module Dry
21
19
  # @return [String]
22
20
  #
23
21
  # @api public
24
- def name
25
- "Any"
26
- end
22
+ def name = "Any"
27
23
 
28
24
  # @param [Hash] new_options
29
25
  #
@@ -37,9 +33,7 @@ module Dry
37
33
  # @return [Array]
38
34
  #
39
35
  # @api public
40
- def to_ast(meta: true)
41
- [:any, meta ? self.meta : EMPTY_HASH]
42
- end
36
+ def to_ast(meta: true) = [:any, meta ? self.meta : EMPTY_HASH]
43
37
  end
44
38
 
45
39
  Any = AnyClass.new
@@ -7,23 +7,17 @@ module Dry
7
7
  # @api private
8
8
  class Constructor < ::Dry::Types::Constructor
9
9
  # @api private
10
- def constructor_type
11
- ::Dry::Types::Array::Constructor
12
- end
10
+ def constructor_type = ::Dry::Types::Array::Constructor
13
11
 
14
12
  # @return [Lax]
15
13
  #
16
14
  # @api public
17
- def lax
18
- Lax.new(type.lax.constructor(fn, meta: meta))
19
- end
15
+ def lax = Lax.new(type.lax.constructor(fn, meta: meta))
20
16
 
21
17
  # @see Dry::Types::Array#of
22
18
  #
23
19
  # @api public
24
- def of(member)
25
- type.of(member).constructor(fn, meta: meta)
26
- end
20
+ def of(member) = type.of(member).constructor(fn, meta: meta)
27
21
  end
28
22
  end
29
23
  end
@@ -113,9 +113,7 @@ module Dry
113
113
  end
114
114
 
115
115
  # @api private
116
- def constructor_type
117
- ::Dry::Types::Array::Constructor
118
- end
116
+ def constructor_type = ::Dry::Types::Array::Constructor
119
117
  end
120
118
  end
121
119
  end
@@ -16,7 +16,7 @@ module Dry
16
16
  def of(type)
17
17
  member =
18
18
  case type
19
- when String then Types[type]
19
+ when ::String then Types[type]
20
20
  else type
21
21
  end
22
22
 
@@ -5,23 +5,18 @@ module Dry
5
5
  # Common API for building types and composition
6
6
  #
7
7
  # @api public
8
- # rubocop:disable Metrics/ModuleLength
9
8
  module Builder
10
- include Dry::Core::Constants
9
+ include ::Dry::Core::Constants
11
10
 
12
11
  # @return [Class]
13
12
  #
14
13
  # @api private
15
- def constrained_type
16
- Constrained
17
- end
14
+ def constrained_type = Constrained
18
15
 
19
16
  # @return [Class]
20
17
  #
21
18
  # @api private
22
- def constructor_type
23
- Constructor
24
- end
19
+ def constructor_type = Constructor
25
20
 
26
21
  # Compose two types into a Sum type
27
22
  #
@@ -30,9 +25,7 @@ module Dry
30
25
  # @return [Sum, Sum::Constrained]
31
26
  #
32
27
  # @api private
33
- def |(other)
34
- compose(other, Sum)
35
- end
28
+ def |(other) = compose(other, Sum)
36
29
 
37
30
  # Compose two types into an Intersection type
38
31
  #
@@ -41,9 +34,7 @@ module Dry
41
34
  # @return [Intersection, Intersection::Constrained]
42
35
  #
43
36
  # @api private
44
- def &(other)
45
- compose(other, Intersection)
46
- end
37
+ def &(other) = compose(other, Intersection)
47
38
 
48
39
  # Compose two types into an Implication type
49
40
  #
@@ -52,18 +43,14 @@ module Dry
52
43
  # @return [Implication, Implication::Constrained]
53
44
  #
54
45
  # @api private
55
- def >(other)
56
- compose(other, Implication)
57
- end
46
+ def >(other) = compose(other, Implication)
58
47
 
59
48
  # Turn a type into an optional type
60
49
  #
61
50
  # @return [Sum]
62
51
  #
63
52
  # @api public
64
- def optional
65
- Types["nil"] | self
66
- end
53
+ def optional = Types["nil"] | self
67
54
 
68
55
  # Turn a type into a constrained type
69
56
  #
@@ -72,8 +59,8 @@ module Dry
72
59
  # @return [Constrained]
73
60
  #
74
61
  # @api public
75
- def constrained(options)
76
- constrained_type.new(self, rule: Types.Rule(options))
62
+ def constrained(...)
63
+ constrained_type.new(self, rule: Types.Rule(...))
77
64
  end
78
65
 
79
66
  # Turn a type into a type with a default value
@@ -91,10 +78,10 @@ module Dry
91
78
  unless input.frozen? || options[:shared]
92
79
  where = Core::Deprecations::STACK.()
93
80
  Core::Deprecations.warn(
94
- "#{input.inspect} is mutable."\
95
- " Be careful: types will return the same instance of the default"\
96
- " value every time. Call `.freeze` when setting the default"\
97
- " or pass `shared: true` to discard this warning."\
81
+ "#{input.inspect} is mutable. " \
82
+ "Be careful: types will return the same instance of the default " \
83
+ "value every time. Call `.freeze` when setting the default " \
84
+ "or pass `shared: true` to discard this warning." \
98
85
  "\n#{where}",
99
86
  tag: :"dry-types"
100
87
  )
@@ -137,9 +124,7 @@ module Dry
137
124
  # @return [Lax]
138
125
  #
139
126
  # @api public
140
- def lax
141
- Lax.new(self)
142
- end
127
+ def lax = Lax.new(self)
143
128
 
144
129
  # Define a constructor for the type
145
130
  #
@@ -182,16 +167,16 @@ module Dry
182
167
  unless value.frozen? || shared
183
168
  where = Core::Deprecations::STACK.()
184
169
  Core::Deprecations.warn(
185
- "#{value.inspect} is mutable."\
186
- " Be careful: types will return the same instance of the fallback"\
187
- " value every time. Call `.freeze` when setting the fallback"\
188
- " or pass `shared: true` to discard this warning."\
170
+ "#{value.inspect} is mutable. " \
171
+ "Be careful: types will return the same instance of the fallback " \
172
+ "value every time. Call `.freeze` when setting the fallback " \
173
+ "or pass `shared: true` to discard this warning." \
189
174
  "\n#{where}",
190
175
  tag: :"dry-types"
191
176
  )
192
177
  end
193
178
 
194
- constructor do |input, type, &_block|
179
+ constructor do |input, type, &|
195
180
  type.(input) do |output = input|
196
181
  if block_given?
197
182
  yield(output)
@@ -216,6 +201,5 @@ module Dry
216
201
  klass.new(self, other)
217
202
  end
218
203
  end
219
- # rubocop:enable Metrics/ModuleLength
220
204
  end
221
205
  end
@@ -23,18 +23,14 @@ module Dry
23
23
  # @param [Dry::Types::Type] type
24
24
  #
25
25
  # @return [Dry::Types::Array]
26
- def Array(type)
27
- Strict(::Array).of(type)
28
- end
26
+ def Array(type) = Strict(::Array).of(type)
29
27
 
30
28
  # Build a hash schema
31
29
  #
32
30
  # @param [Hash{Symbol => Dry::Types::Type}] type_map
33
31
  #
34
32
  # @return [Dry::Types::Array]
35
- def Hash(type_map)
36
- Strict(::Hash).schema(type_map)
37
- end
33
+ def Hash(type_map) = Strict(::Hash).schema(type_map)
38
34
 
39
35
  # Build a type which values are instances of a given class
40
36
  # Values are checked using `is_a?` call
@@ -47,9 +43,7 @@ module Dry
47
43
  # @param [Class,Module] klass Class or module
48
44
  #
49
45
  # @return [Dry::Types::Type]
50
- def Instance(klass)
51
- Nominal(klass).constrained(type: klass)
52
- end
46
+ def Instance(klass) = Nominal(klass).constrained(type: klass)
53
47
  alias_method :Strict, :Instance
54
48
 
55
49
  # Build a type with a single value
@@ -58,9 +52,7 @@ module Dry
58
52
  # @param [Object] value
59
53
  #
60
54
  # @return [Dry::Types::Type]
61
- def Value(value)
62
- Nominal(value.class).constrained(eql: value)
63
- end
55
+ def Value(value) = Nominal(value.class).constrained(eql: value)
64
56
 
65
57
  # Build a type with a single value
66
58
  # The equality check done with `equal?`
@@ -68,9 +60,7 @@ module Dry
68
60
  # @param [Object] object
69
61
  #
70
62
  # @return [Dry::Types::Type]
71
- def Constant(object)
72
- Nominal(object.class).constrained(is: object)
73
- end
63
+ def Constant(object) = Nominal(object.class).constrained(is: object)
74
64
 
75
65
  # Build a constructor type
76
66
  # If no constructor block given it uses .new method
@@ -21,7 +21,7 @@ module Dry
21
21
  # @raise CoercionError
22
22
  #
23
23
  # @api public
24
- def self.to_nil(input, &_block)
24
+ def self.to_nil(input, &)
25
25
  if input.nil?
26
26
  nil
27
27
  elsif block_given?
@@ -38,13 +38,13 @@ module Dry
38
38
  # @raise CoercionError
39
39
  #
40
40
  # @api public
41
- def self.to_decimal(input, &_block)
41
+ def self.to_decimal(input, &)
42
42
  if input.is_a?(::Float)
43
43
  input.to_d
44
44
  else
45
45
  BigDecimal(input)
46
46
  end
47
- rescue ArgumentError, TypeError
47
+ rescue ::ArgumentError, ::TypeError
48
48
  if block_given?
49
49
  yield
50
50
  else
@@ -26,7 +26,7 @@ module Dry
26
26
  # @raise CoercionError
27
27
  #
28
28
  # @api public
29
- def self.to_nil(input, &_block)
29
+ def self.to_nil(input, &)
30
30
  if input.nil? || empty_str?(input)
31
31
  nil
32
32
  elsif block_given?
@@ -46,7 +46,7 @@ module Dry
46
46
  # @raise CoercionError
47
47
  #
48
48
  # @api public
49
- def self.to_true(input, &_block)
49
+ def self.to_true(input, &)
50
50
  BOOLEAN_MAP.fetch(input.to_s) do
51
51
  if block_given?
52
52
  yield
@@ -66,7 +66,7 @@ module Dry
66
66
  # @raise CoercionError
67
67
  #
68
68
  # @api public
69
- def self.to_false(input, &_block)
69
+ def self.to_false(input, &)
70
70
  BOOLEAN_MAP.fetch(input.to_s) do
71
71
  if block_given?
72
72
  yield
@@ -83,14 +83,14 @@ module Dry
83
83
  # @raise CoercionError
84
84
  #
85
85
  # @api public
86
- def self.to_int(input, &block)
87
- if input.is_a? String
86
+ def self.to_int(input, &)
87
+ if input.is_a?(::String)
88
88
  Integer(input, 10)
89
89
  else
90
90
  Integer(input)
91
91
  end
92
- rescue ArgumentError, TypeError => e
93
- CoercionError.handle(e, &block)
92
+ rescue ::ArgumentError, ::TypeError => e
93
+ CoercionError.handle(e, &)
94
94
  end
95
95
 
96
96
  # @param [#to_f, Object] input
@@ -100,10 +100,10 @@ module Dry
100
100
  # @raise CoercionError
101
101
  #
102
102
  # @api public
103
- def self.to_float(input, &block)
103
+ def self.to_float(input, &)
104
104
  Float(input)
105
- rescue ArgumentError, TypeError => e
106
- CoercionError.handle(e, &block)
105
+ rescue ::ArgumentError, ::TypeError => e
106
+ CoercionError.handle(e, &)
107
107
  end
108
108
 
109
109
  # @param [#to_d, Object] input
@@ -113,7 +113,7 @@ module Dry
113
113
  # @raise CoercionError
114
114
  #
115
115
  # @api public
116
- def self.to_decimal(input, &_block)
116
+ def self.to_decimal(input, &)
117
117
  to_float(input) do
118
118
  if block_given?
119
119
  return yield
@@ -132,7 +132,7 @@ module Dry
132
132
  # @raise CoercionError
133
133
  #
134
134
  # @api public
135
- def self.to_ary(input, &_block)
135
+ def self.to_ary(input, &)
136
136
  if empty_str?(input)
137
137
  []
138
138
  elsif input.is_a?(::Array)
@@ -151,7 +151,7 @@ module Dry
151
151
  # @raise CoercionError
152
152
  #
153
153
  # @api public
154
- def self.to_hash(input, &_block)
154
+ def self.to_hash(input, &)
155
155
  if empty_str?(input)
156
156
  {}
157
157
  elsif input.is_a?(::Hash)
@@ -15,12 +15,12 @@ module Dry
15
15
  # @see Date.parse
16
16
  #
17
17
  # @api public
18
- def to_date(input, &block)
18
+ def to_date(input, &)
19
19
  if input.respond_to?(:to_str)
20
20
  begin
21
21
  ::Date.parse(input)
22
- rescue ArgumentError, RangeError => e
23
- CoercionError.handle(e, &block)
22
+ rescue ::ArgumentError, ::RangeError => e
23
+ CoercionError.handle(e, &)
24
24
  end
25
25
  elsif input.is_a?(::Date)
26
26
  input
@@ -38,12 +38,12 @@ module Dry
38
38
  # @see DateTime.parse
39
39
  #
40
40
  # @api public
41
- def to_date_time(input, &block)
41
+ def to_date_time(input, &)
42
42
  if input.respond_to?(:to_str)
43
43
  begin
44
44
  ::DateTime.parse(input)
45
- rescue ArgumentError => e
46
- CoercionError.handle(e, &block)
45
+ rescue ::ArgumentError => e
46
+ CoercionError.handle(e, &)
47
47
  end
48
48
  elsif input.is_a?(::DateTime)
49
49
  input
@@ -61,12 +61,12 @@ module Dry
61
61
  # @see Time.parse
62
62
  #
63
63
  # @api public
64
- def to_time(input, &block)
64
+ def to_time(input, &)
65
65
  if input.respond_to?(:to_str)
66
66
  begin
67
67
  ::Time.parse(input)
68
- rescue ArgumentError => e
69
- CoercionError.handle(e, &block)
68
+ rescue ::ArgumentError => e
69
+ CoercionError.handle(e, &)
70
70
  end
71
71
  elsif input.is_a?(::Time)
72
72
  input
@@ -84,10 +84,10 @@ module Dry
84
84
  # @raise CoercionError
85
85
  #
86
86
  # @api public
87
- def to_symbol(input, &block)
87
+ def to_symbol(input, &)
88
88
  input.to_sym
89
- rescue NoMethodError => e
90
- CoercionError.handle(e, &block)
89
+ rescue ::NoMethodError => e
90
+ CoercionError.handle(e, &)
91
91
  end
92
92
 
93
93
  private
@@ -99,9 +99,7 @@ module Dry
99
99
  # @return [Boolean]
100
100
  #
101
101
  # @api private
102
- def empty_str?(value)
103
- EMPTY_STRING.eql?(value)
104
- end
102
+ def empty_str?(value) = EMPTY_STRING.eql?(value)
105
103
  end
106
104
  end
107
105
  end
@@ -12,9 +12,7 @@ module Dry
12
12
  @registry = registry
13
13
  end
14
14
 
15
- def call(ast)
16
- visit(ast)
17
- end
15
+ def call(ast) = visit(ast)
18
16
 
19
17
  def visit(node)
20
18
  type, body = node
@@ -50,7 +48,7 @@ module Dry
50
48
  end
51
49
 
52
50
  def visit_rule(node)
53
- Dry::Types.rule_compiler.([node])[0]
51
+ ::Dry::Types.rule_compiler.([node])[0]
54
52
  end
55
53
 
56
54
  def visit_sum(node)
@@ -60,7 +58,7 @@ module Dry
60
58
 
61
59
  def visit_array(node)
62
60
  member, meta = node
63
- member = member.is_a?(Class) ? member : visit(member)
61
+ member = visit(member) unless member.is_a?(::Class)
64
62
  registry["nominal.array"].of(member).meta(meta)
65
63
  end
66
64
 
@@ -118,14 +116,14 @@ module Dry
118
116
 
119
117
  case type
120
118
  when :id
121
- Dry::Types::FnContainer[node.fetch(0)]
119
+ ::Dry::Types::FnContainer[node.fetch(0)]
122
120
  when :callable
123
121
  node.fetch(0)
124
122
  when :method
125
123
  target, method = node
126
124
  target.method(method)
127
125
  else
128
- raise ArgumentError, "Cannot build callable from #{fn.inspect}"
126
+ raise ::ArgumentError, "Cannot build callable from #{fn.inspect}"
129
127
  end
130
128
  end
131
129
  end