sorbet-runtime 0.5.9154 → 0.5.9182
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/lib/types/_types.rb +8 -6
- data/lib/types/configuration.rb +50 -40
- data/lib/types/enum.rb +3 -3
- data/lib/types/private/casts.rb +2 -2
- data/lib/types/private/methods/signature.rb +1 -1
- data/lib/types/private/types/not_typed.rb +3 -3
- data/lib/types/private/types/string_holder.rb +3 -3
- data/lib/types/private/types/type_alias.rb +3 -3
- data/lib/types/private/types/void.rb +3 -3
- data/lib/types/props/_props.rb +6 -9
- data/lib/types/props/custom_type.rb +1 -1
- data/lib/types/props/decorator.rb +1 -1
- data/lib/types/props/serializable.rb +1 -3
- data/lib/types/types/attached_class.rb +3 -3
- data/lib/types/types/class_of.rb +4 -4
- data/lib/types/types/enum.rb +4 -4
- data/lib/types/types/fixed_array.rb +5 -5
- data/lib/types/types/fixed_hash.rb +7 -7
- data/lib/types/types/intersection.rb +4 -4
- data/lib/types/types/noreturn.rb +3 -3
- data/lib/types/types/proc.rb +3 -3
- data/lib/types/types/self_type.rb +3 -3
- data/lib/types/types/simple.rb +3 -3
- data/lib/types/types/t_enum.rb +3 -3
- data/lib/types/types/typed_array.rb +3 -3
- data/lib/types/types/typed_enumerable.rb +5 -5
- data/lib/types/types/typed_enumerator.rb +3 -3
- data/lib/types/types/typed_hash.rb +3 -3
- data/lib/types/types/typed_range.rb +3 -3
- data/lib/types/types/typed_set.rb +3 -3
- data/lib/types/types/union.rb +4 -4
- data/lib/types/types/untyped.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9d845ae192eaf142af71d57ebceb18623876f19c5cca1785f24dd175e5788a4
|
|
4
|
+
data.tar.gz: ca5a9ec6e5ed862d00244f16ca97f7b9aa7aef0af024c13304dea7e021ed9010
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e59c0eff020d34f87d783ef646fa8c98e5915dbc9da4a00a8302bb6c732e16e26cf716529956482fc81a2f3143a0acc6eb92284206cd50b638591d9d60785e9a
|
|
7
|
+
data.tar.gz: facc6fa1c4f285b5d38e80157210485b6e099d3600ac7451f048bed411b4cc86fd8b7c66f04d2a2396b9394e113fa9def20f037285437f72f515291724ef2ad8
|
data/lib/types/_types.rb
CHANGED
|
@@ -82,8 +82,9 @@ module T
|
|
|
82
82
|
|
|
83
83
|
# Constructs a type alias. Used to create a short name for a larger type. In Ruby this returns a
|
|
84
84
|
# wrapper that contains a proc that is evaluated to get the underlying type. This syntax however
|
|
85
|
-
# is needed for support by the static checker.
|
|
85
|
+
# is needed for support by the static checker.
|
|
86
86
|
#
|
|
87
|
+
# @example
|
|
87
88
|
# NilableString = T.type_alias {T.nilable(String)}
|
|
88
89
|
#
|
|
89
90
|
# sig {params(arg: NilableString, default: String).returns(String)}
|
|
@@ -106,8 +107,9 @@ module T
|
|
|
106
107
|
# References a type parameter which was previously defined with
|
|
107
108
|
# `type_parameters`.
|
|
108
109
|
#
|
|
109
|
-
# This is used for generic methods.
|
|
110
|
+
# This is used for generic methods.
|
|
110
111
|
#
|
|
112
|
+
# @example
|
|
111
113
|
# sig
|
|
112
114
|
# .type_parameters(:U)
|
|
113
115
|
# .params(
|
|
@@ -185,7 +187,7 @@ module T
|
|
|
185
187
|
# cycle. However, we also don't actually need to do so; An untyped
|
|
186
188
|
# identity method works just as well here.
|
|
187
189
|
#
|
|
188
|
-
# sig {params(value: T.untyped).returns(T.untyped)}
|
|
190
|
+
# `sig {params(value: T.untyped).returns(T.untyped)}`
|
|
189
191
|
def self.unsafe(value)
|
|
190
192
|
value
|
|
191
193
|
end
|
|
@@ -206,7 +208,7 @@ module T
|
|
|
206
208
|
# Intended to be used to promise sorbet that a given nilable value happens
|
|
207
209
|
# to contain a non-nil value at this point.
|
|
208
210
|
#
|
|
209
|
-
# sig {params(arg: T.nilable(A)).returns(A)}
|
|
211
|
+
# `sig {params(arg: T.nilable(A)).returns(A)}`
|
|
210
212
|
def self.must(arg)
|
|
211
213
|
return arg if arg
|
|
212
214
|
return arg if arg == false
|
|
@@ -214,7 +216,7 @@ module T
|
|
|
214
216
|
begin
|
|
215
217
|
raise TypeError.new("Passed `nil` into T.must")
|
|
216
218
|
rescue TypeError => e # raise into rescue to ensure e.backtrace is populated
|
|
217
|
-
T::Configuration.inline_type_error_handler(e)
|
|
219
|
+
T::Configuration.inline_type_error_handler(e, {kind: 'T.must', value: arg, type: nil})
|
|
218
220
|
end
|
|
219
221
|
end
|
|
220
222
|
|
|
@@ -239,7 +241,7 @@ module T
|
|
|
239
241
|
begin
|
|
240
242
|
raise TypeError.new(msg)
|
|
241
243
|
rescue TypeError => e # raise into rescue to ensure e.backtrace is populated
|
|
242
|
-
T::Configuration.inline_type_error_handler(e)
|
|
244
|
+
T::Configuration.inline_type_error_handler(e, {kind: 'T.absurd', value: value, type: nil})
|
|
243
245
|
end
|
|
244
246
|
end
|
|
245
247
|
|
data/lib/types/configuration.rb
CHANGED
|
@@ -130,10 +130,15 @@ module T::Configuration
|
|
|
130
130
|
#
|
|
131
131
|
# Parameters passed to value.call:
|
|
132
132
|
#
|
|
133
|
-
#
|
|
133
|
+
# @param [TypeError] error TypeError that was raised
|
|
134
|
+
# @param [Hash] opts A hash containing contextual information on the error:
|
|
135
|
+
# @option opts [String] :kind One of:
|
|
136
|
+
# ['T.cast', 'T.let', 'T.bind', 'T.assert_type!', 'T.must', 'T.absurd']
|
|
137
|
+
# @option opts [Object, nil] :type Expected param/return value type
|
|
138
|
+
# @option opts [Object] :value Actual param/return value
|
|
134
139
|
#
|
|
135
140
|
# @example
|
|
136
|
-
# T::Configuration.inline_type_error_handler = lambda do |error|
|
|
141
|
+
# T::Configuration.inline_type_error_handler = lambda do |error, opts|
|
|
137
142
|
# puts error.message
|
|
138
143
|
# end
|
|
139
144
|
def self.inline_type_error_handler=(value)
|
|
@@ -141,15 +146,20 @@ module T::Configuration
|
|
|
141
146
|
@inline_type_error_handler = value
|
|
142
147
|
end
|
|
143
148
|
|
|
144
|
-
private_class_method def self.inline_type_error_handler_default(error)
|
|
149
|
+
private_class_method def self.inline_type_error_handler_default(error, opts)
|
|
145
150
|
raise error
|
|
146
151
|
end
|
|
147
152
|
|
|
148
|
-
def self.inline_type_error_handler(error)
|
|
153
|
+
def self.inline_type_error_handler(error, opts={})
|
|
149
154
|
if @inline_type_error_handler
|
|
150
|
-
|
|
155
|
+
# Backwards compatibility before `inline_type_error_handler` took a second arg
|
|
156
|
+
if @inline_type_error_handler.arity == 1
|
|
157
|
+
@inline_type_error_handler.call(error)
|
|
158
|
+
else
|
|
159
|
+
@inline_type_error_handler.call(error, opts)
|
|
160
|
+
end
|
|
151
161
|
else
|
|
152
|
-
inline_type_error_handler_default(error)
|
|
162
|
+
inline_type_error_handler_default(error, opts)
|
|
153
163
|
end
|
|
154
164
|
nil
|
|
155
165
|
end
|
|
@@ -169,8 +179,8 @@ module T::Configuration
|
|
|
169
179
|
#
|
|
170
180
|
# Parameters passed to value.call:
|
|
171
181
|
#
|
|
172
|
-
#
|
|
173
|
-
#
|
|
182
|
+
# @param [StandardError] error The error that was raised
|
|
183
|
+
# @param [Thread::Backtrace::Location] location Location of the error
|
|
174
184
|
#
|
|
175
185
|
# @example
|
|
176
186
|
# T::Configuration.sig_builder_error_handler = lambda do |error, location|
|
|
@@ -211,16 +221,16 @@ module T::Configuration
|
|
|
211
221
|
#
|
|
212
222
|
# Parameters passed to value.call:
|
|
213
223
|
#
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
#
|
|
217
|
-
#
|
|
218
|
-
#
|
|
219
|
-
#
|
|
220
|
-
#
|
|
221
|
-
#
|
|
222
|
-
#
|
|
223
|
-
#
|
|
224
|
+
# @param [StandardError] error The error that was raised
|
|
225
|
+
# @param [Hash] opts A hash containing contextual information on the error:
|
|
226
|
+
# @option opts [Method, UnboundMethod] :method Method on which the signature build failed
|
|
227
|
+
# @option opts [T::Private::Methods::Declaration] :declaration Method
|
|
228
|
+
# signature declaration struct
|
|
229
|
+
# @option opts [T::Private::Methods::Signature, nil] :signature Signature
|
|
230
|
+
# that failed (nil if sig build failed before Signature initialization)
|
|
231
|
+
# @option opts [T::Private::Methods::Signature, nil] :super_signature Super
|
|
232
|
+
# method's signature (nil if method is not an override or super method
|
|
233
|
+
# does not have a method signature)
|
|
224
234
|
#
|
|
225
235
|
# @example
|
|
226
236
|
# T::Configuration.sig_validation_error_handler = lambda do |error, opts|
|
|
@@ -256,17 +266,17 @@ module T::Configuration
|
|
|
256
266
|
#
|
|
257
267
|
# Parameters passed to value.call:
|
|
258
268
|
#
|
|
259
|
-
#
|
|
260
|
-
#
|
|
261
|
-
#
|
|
262
|
-
#
|
|
263
|
-
#
|
|
264
|
-
#
|
|
265
|
-
#
|
|
266
|
-
#
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
#
|
|
269
|
+
# @param [T::Private::Methods::Signature] signature Signature that failed
|
|
270
|
+
# @param [Hash] opts A hash containing contextual information on the error:
|
|
271
|
+
# @option opts [String] :message Error message
|
|
272
|
+
# @option opts [String] :kind One of:
|
|
273
|
+
# ['Parameter', 'Block parameter', 'Return value']
|
|
274
|
+
# @option opts [Symbol] :name Param or block param name (nil for return
|
|
275
|
+
# value)
|
|
276
|
+
# @option opts [Object] :type Expected param/return value type
|
|
277
|
+
# @option opts [Object] :value Actual param/return value
|
|
278
|
+
# @option opts [Thread::Backtrace::Location] :location Location of the
|
|
279
|
+
# caller
|
|
270
280
|
#
|
|
271
281
|
# @example
|
|
272
282
|
# T::Configuration.call_validation_error_handler = lambda do |signature, opts|
|
|
@@ -297,8 +307,8 @@ module T::Configuration
|
|
|
297
307
|
#
|
|
298
308
|
# Parameters passed to value.call:
|
|
299
309
|
#
|
|
300
|
-
#
|
|
301
|
-
#
|
|
310
|
+
# @param [String] str Message to be logged
|
|
311
|
+
# @param [Hash] extra A hash containing additional parameters to be passed along to the logger.
|
|
302
312
|
#
|
|
303
313
|
# @example
|
|
304
314
|
# T::Configuration.log_info_handler = lambda do |str, extra|
|
|
@@ -331,8 +341,8 @@ module T::Configuration
|
|
|
331
341
|
#
|
|
332
342
|
# Parameters passed to value.call:
|
|
333
343
|
#
|
|
334
|
-
#
|
|
335
|
-
#
|
|
344
|
+
# @param [String] str Assertion message
|
|
345
|
+
# @param [Hash] extra A hash containing additional parameters to be passed along to the handler.
|
|
336
346
|
#
|
|
337
347
|
# @example
|
|
338
348
|
# T::Configuration.soft_assert_handler = lambda do |str, extra|
|
|
@@ -365,8 +375,8 @@ module T::Configuration
|
|
|
365
375
|
#
|
|
366
376
|
# Parameters passed to value.call:
|
|
367
377
|
#
|
|
368
|
-
#
|
|
369
|
-
#
|
|
378
|
+
# @param [String] str Assertion message
|
|
379
|
+
# @param [Hash] extra A hash containing additional parameters to be passed along to the handler.
|
|
370
380
|
#
|
|
371
381
|
# @example
|
|
372
382
|
# T::Configuration.hard_assert_handler = lambda do |str, extra|
|
|
@@ -392,7 +402,7 @@ module T::Configuration
|
|
|
392
402
|
# Set a list of class strings that are to be considered scalar.
|
|
393
403
|
# (pass nil to reset to default behavior)
|
|
394
404
|
#
|
|
395
|
-
# @param [String]
|
|
405
|
+
# @param [String] values Class name.
|
|
396
406
|
#
|
|
397
407
|
# @example
|
|
398
408
|
# T::Configuration.scalar_types = ["NilClass", "TrueClass", "FalseClass", ...]
|
|
@@ -445,7 +455,7 @@ module T::Configuration
|
|
|
445
455
|
# to names in generated code. Used by the runtime implementation
|
|
446
456
|
# associated with `--stripe-packages` mode.
|
|
447
457
|
#
|
|
448
|
-
# @param [Lambda, Proc, nil]
|
|
458
|
+
# @param [Lambda, Proc, nil] handler Proc that converts a type (Class/Module)
|
|
449
459
|
# to a String (pass nil to reset to default behavior)
|
|
450
460
|
def self.module_name_mangler=(handler)
|
|
451
461
|
@module_name_mangler = handler
|
|
@@ -454,7 +464,7 @@ module T::Configuration
|
|
|
454
464
|
# Set to a PII handler function. This will be called with the `sensitivity:`
|
|
455
465
|
# annotations on things that use `T::Props` and can modify them ahead-of-time.
|
|
456
466
|
#
|
|
457
|
-
# @param [Lambda, Proc, nil]
|
|
467
|
+
# @param [Lambda, Proc, nil] handler Proc that takes a hash mapping symbols to the
|
|
458
468
|
# prop values. Pass nil to avoid changing `sensitivity:` annotations.
|
|
459
469
|
def self.normalize_sensitivity_and_pii_handler=(handler)
|
|
460
470
|
@sensitivity_and_pii_handler = handler
|
|
@@ -470,7 +480,7 @@ module T::Configuration
|
|
|
470
480
|
# `nil` and will raise an exception when the redacted version of a prop is
|
|
471
481
|
# accessed.
|
|
472
482
|
#
|
|
473
|
-
# @param [Lambda, Proc, nil]
|
|
483
|
+
# @param [Lambda, Proc, nil] handler Proc that converts a value into its
|
|
474
484
|
# redacted version according to the spec passed as the second argument.
|
|
475
485
|
def self.redaction_handler=(handler)
|
|
476
486
|
@redaction_handler = handler
|
|
@@ -483,7 +493,7 @@ module T::Configuration
|
|
|
483
493
|
# Set to a function which can get the 'owner' of a class. This is
|
|
484
494
|
# used in reporting deserialization errors
|
|
485
495
|
#
|
|
486
|
-
# @param [Lambda, Proc, nil]
|
|
496
|
+
# @param [Lambda, Proc, nil] handler Proc that takes a class and
|
|
487
497
|
# produces its owner, or `nil` if it does not have one.
|
|
488
498
|
def self.class_owner_finder=(handler)
|
|
489
499
|
@class_owner_finder = handler
|
data/lib/types/enum.rb
CHANGED
|
@@ -47,7 +47,7 @@ class T::Enum
|
|
|
47
47
|
SerializedVal = T.type_alias {T.untyped}
|
|
48
48
|
private_constant :SerializedVal
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### Enum class methods ###
|
|
51
51
|
sig {returns(T::Array[T.attached_class])}
|
|
52
52
|
def self.values
|
|
53
53
|
if @values.nil?
|
|
@@ -134,7 +134,7 @@ class T::Enum
|
|
|
134
134
|
self.from_serialized(mongo_value)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
### Enum instance methods ###
|
|
138
138
|
|
|
139
139
|
sig {returns(T.self_type)}
|
|
140
140
|
def dup
|
|
@@ -243,7 +243,7 @@ class T::Enum
|
|
|
243
243
|
)
|
|
244
244
|
end
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
### Private implementation ###
|
|
247
247
|
|
|
248
248
|
sig {params(serialized_val: SerializedVal).void}
|
|
249
249
|
def initialize(serialized_val=nil)
|
data/lib/types/private/casts.rb
CHANGED
|
@@ -14,7 +14,7 @@ module T::Private
|
|
|
14
14
|
|
|
15
15
|
raise TypeError.new("#{cast_method}: #{error}\n#{suffix}")
|
|
16
16
|
rescue TypeError => e # raise into rescue to ensure e.backtrace is populated
|
|
17
|
-
T::Configuration.inline_type_error_handler(e)
|
|
17
|
+
T::Configuration.inline_type_error_handler(e, {kind: cast_method, value: value, type: type})
|
|
18
18
|
value
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -33,7 +33,7 @@ module T::Private
|
|
|
33
33
|
|
|
34
34
|
raise TypeError.new("#{cast_method}: #{error}\n#{suffix}")
|
|
35
35
|
rescue TypeError => e # raise into rescue to ensure e.backtrace is populated
|
|
36
|
-
T::Configuration.inline_type_error_handler(e)
|
|
36
|
+
T::Configuration.inline_type_error_handler(e, {kind: cast_method, value: value, type: type})
|
|
37
37
|
value
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -156,7 +156,7 @@ class T::Private::Methods::Signature
|
|
|
156
156
|
"#{@mode}_method"
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
-
# @return [Hash] a mapping like {arg_name: [val, type], ...}
|
|
159
|
+
# @return [Hash] a mapping like `{arg_name: [val, type], ...}`, for only those args actually present.
|
|
160
160
|
def each_args_value_type(args)
|
|
161
161
|
# Manually split out args and kwargs based on ruby's behavior. Do not try to implement this by
|
|
162
162
|
# getting ruby to determine the kwargs for you (e.g., by defining this method to take *args and
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
class T::Private::Types::NotTyped < T::Types::Base
|
|
7
7
|
ERROR_MESSAGE = "Validation is being done on a `NotTyped`. Please report to #dev-productivity."
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# overrides Base
|
|
10
10
|
def name
|
|
11
11
|
"<NOT-TYPED>"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
#
|
|
14
|
+
# overrides Base
|
|
15
15
|
def valid?(obj)
|
|
16
16
|
raise ERROR_MESSAGE
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# overrides Base
|
|
20
20
|
private def subtype_of_single?(other)
|
|
21
21
|
raise ERROR_MESSAGE
|
|
22
22
|
end
|
|
@@ -9,17 +9,17 @@ class T::Private::Types::StringHolder < T::Types::Base
|
|
|
9
9
|
@string = string
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
#
|
|
12
|
+
# overrides Base
|
|
13
13
|
def name
|
|
14
14
|
string
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# overrides Base
|
|
18
18
|
def valid?(obj)
|
|
19
19
|
false
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
private def subtype_of_single?(other)
|
|
24
24
|
false
|
|
25
25
|
end
|
|
@@ -13,17 +13,17 @@ module T::Private::Types
|
|
|
13
13
|
@aliased_type ||= T::Utils.coerce(@callable.call)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
#
|
|
16
|
+
# overrides Base
|
|
17
17
|
def name
|
|
18
18
|
aliased_type.name
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# overrides Base
|
|
22
22
|
def recursively_valid?(obj)
|
|
23
23
|
aliased_type.recursively_valid?(obj)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# overrides Base
|
|
27
27
|
def valid?(obj)
|
|
28
28
|
aliased_type.valid?(obj)
|
|
29
29
|
end
|
|
@@ -17,17 +17,17 @@ class T::Private::Types::Void < T::Types::Base
|
|
|
17
17
|
freeze
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# overrides Base
|
|
21
21
|
def name
|
|
22
22
|
"<VOID>"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
#
|
|
25
|
+
# overrides Base
|
|
26
26
|
def valid?(obj)
|
|
27
27
|
raise ERROR_MESSAGE
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
#
|
|
30
|
+
# overrides Base
|
|
31
31
|
private def subtype_of_single?(other)
|
|
32
32
|
raise ERROR_MESSAGE
|
|
33
33
|
end
|
data/lib/types/props/_props.rb
CHANGED
|
@@ -38,8 +38,6 @@ module T::Props
|
|
|
38
38
|
@decorator = decorator_class.new(self)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
# @!method self.prop(name, type, opts={})
|
|
42
|
-
#
|
|
43
41
|
# Define a new property. See {file:README.md} for some concrete
|
|
44
42
|
# examples.
|
|
45
43
|
#
|
|
@@ -50,7 +48,7 @@ module T::Props
|
|
|
50
48
|
#
|
|
51
49
|
# @param name [Symbol] The name of this property
|
|
52
50
|
# @param cls [Class,T::Types::Base] The type of this
|
|
53
|
-
# property. If the type is itself a
|
|
51
|
+
# property. If the type is itself a `Document` subclass, this
|
|
54
52
|
# property will be recursively serialized/deserialized.
|
|
55
53
|
# @param rules [Hash] Options to control this property's behavior.
|
|
56
54
|
# @option rules [T::Boolean,Symbol] :optional If `true`, this property
|
|
@@ -61,7 +59,7 @@ module T::Props
|
|
|
61
59
|
# If `false`, when the property is missing/nil after deserialization, it
|
|
62
60
|
# will be set to the default value (as defined by the `default` or
|
|
63
61
|
# `factory` option) or will raise if they are not present.
|
|
64
|
-
# Deprecated: For
|
|
62
|
+
# Deprecated: For `Model`s, if `:optional` is set to the special value
|
|
65
63
|
# `:existing`, the property can be saved as nil even if it was
|
|
66
64
|
# deserialized with a non-nil value. (Deprecated because there should
|
|
67
65
|
# never be a need for this behavior; the new behavior of non-optional
|
|
@@ -69,7 +67,8 @@ module T::Props
|
|
|
69
67
|
# @option rules [Array] :enum An array of legal values; The
|
|
70
68
|
# property is required to take on one of those values.
|
|
71
69
|
# @option rules [T::Boolean] :dont_store If true, this property will
|
|
72
|
-
# not be saved on the hash resulting from
|
|
70
|
+
# not be saved on the hash resulting from
|
|
71
|
+
# {T::Props::Serializable#serialize}
|
|
73
72
|
# @option rules [Object] :ifunset A value to be returned if this
|
|
74
73
|
# property is requested but has never been set (is set to
|
|
75
74
|
# `nil`). It is applied at property-access time, and never saved
|
|
@@ -93,10 +92,10 @@ module T::Props
|
|
|
93
92
|
# class directly.
|
|
94
93
|
#
|
|
95
94
|
# @option rules [Object] :default A default value that will be set
|
|
96
|
-
# by
|
|
95
|
+
# by `#initialize` if none is provided in the initialization
|
|
97
96
|
# hash. This will not affect objects loaded by {.from_hash}.
|
|
98
97
|
# @option rules [Proc] :factory A `Proc` that will be called to
|
|
99
|
-
# generate an initial value for this prop on
|
|
98
|
+
# generate an initial value for this prop on `#initialize`, if
|
|
100
99
|
# none is provided.
|
|
101
100
|
# @option rules [T::Boolean] :immutable If true, this prop cannot be
|
|
102
101
|
# modified after an instance is created or loaded from a hash.
|
|
@@ -116,8 +115,6 @@ module T::Props
|
|
|
116
115
|
decorator.prop_defined(name, cls, rules)
|
|
117
116
|
end
|
|
118
117
|
|
|
119
|
-
# @!method validate_prop_value(propname, value)
|
|
120
|
-
#
|
|
121
118
|
# Validates the value of the specified prop. This method allows the caller to
|
|
122
119
|
# validate a value for a prop without having to set the data on the instance.
|
|
123
120
|
# Throws if invalid.
|
|
@@ -37,7 +37,7 @@ module T::Props
|
|
|
37
37
|
# Given an instance of this type, serialize that into a scalar type
|
|
38
38
|
# supported by T::Props.
|
|
39
39
|
#
|
|
40
|
-
# @param [Object]
|
|
40
|
+
# @param [Object] instance
|
|
41
41
|
# @return An instance of one of T::Configuration.scalar_types
|
|
42
42
|
sig {abstract.params(instance: T.untyped).returns(T.untyped).checked(:never)}
|
|
43
43
|
def serialize(instance); end
|
|
@@ -325,7 +325,7 @@ module T::Props::Serializable::DecoratorMethods
|
|
|
325
325
|
instance.instance_variable_get(:@_extra_props) || EMPTY_EXTRA_PROPS
|
|
326
326
|
end
|
|
327
327
|
|
|
328
|
-
#
|
|
328
|
+
# overrides T::Props::PrettyPrintable
|
|
329
329
|
private def inspect_instance_components(instance, multiline:, indent:)
|
|
330
330
|
if (extra_props = extra_props(instance)) && !extra_props.empty?
|
|
331
331
|
pretty_kvs = extra_props.map {|k, v| [k.to_sym, v.inspect]}
|
|
@@ -346,8 +346,6 @@ module T::Props::Serializable::ClassMethods
|
|
|
346
346
|
@prop_by_serialized_forms ||= {}
|
|
347
347
|
end
|
|
348
348
|
|
|
349
|
-
# @!method self.from_hash(hash, strict)
|
|
350
|
-
#
|
|
351
349
|
# Allocate a new instance and call {#deserialize} to load a new
|
|
352
350
|
# object from a hash.
|
|
353
351
|
# @return [Serializable]
|
|
@@ -10,17 +10,17 @@ module T::Types
|
|
|
10
10
|
|
|
11
11
|
def initialize(); end
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# overrides Base
|
|
14
14
|
def name
|
|
15
15
|
"T.attached_class"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# overrides Base
|
|
19
19
|
def valid?(obj)
|
|
20
20
|
true
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# overrides Base
|
|
24
24
|
private def subtype_of_single?(other)
|
|
25
25
|
case other
|
|
26
26
|
when AttachedClassType
|
data/lib/types/types/class_of.rb
CHANGED
|
@@ -10,17 +10,17 @@ module T::Types
|
|
|
10
10
|
@type = type
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# overrides Base
|
|
14
14
|
def name
|
|
15
15
|
"T.class_of(#{@type})"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# overrides Base
|
|
19
19
|
def valid?(obj)
|
|
20
20
|
obj.is_a?(Module) && obj <= @type
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# overrides Base
|
|
24
24
|
def subtype_of_single?(other)
|
|
25
25
|
case other
|
|
26
26
|
when ClassOf
|
|
@@ -30,7 +30,7 @@ module T::Types
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
#
|
|
33
|
+
# overrides Base
|
|
34
34
|
def describe_obj(obj)
|
|
35
35
|
obj.inspect
|
|
36
36
|
end
|
data/lib/types/types/enum.rb
CHANGED
|
@@ -14,12 +14,12 @@ module T::Types
|
|
|
14
14
|
@values = values
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# overrides Base
|
|
18
18
|
def valid?(obj)
|
|
19
19
|
@values.member?(obj)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
private def subtype_of_single?(other)
|
|
24
24
|
case other
|
|
25
25
|
when Enum
|
|
@@ -29,12 +29,12 @@ module T::Types
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# overrides Base
|
|
33
33
|
def name
|
|
34
34
|
"T.enum([#{@values.map(&:inspect).join(', ')}])"
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# overrides Base
|
|
38
38
|
def describe_obj(obj)
|
|
39
39
|
obj.inspect
|
|
40
40
|
end
|
|
@@ -12,12 +12,12 @@ module T::Types
|
|
|
12
12
|
@types = types.map {|type| T::Utils.coerce(type)}
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# overrides Base
|
|
16
16
|
def name
|
|
17
17
|
"[#{@types.join(', ')}]"
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# overrides Base
|
|
21
21
|
def recursively_valid?(obj)
|
|
22
22
|
if obj.is_a?(Array) && obj.length == @types.length
|
|
23
23
|
i = 0
|
|
@@ -33,7 +33,7 @@ module T::Types
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
#
|
|
36
|
+
# overrides Base
|
|
37
37
|
def valid?(obj)
|
|
38
38
|
if obj.is_a?(Array) && obj.length == @types.length
|
|
39
39
|
i = 0
|
|
@@ -49,7 +49,7 @@ module T::Types
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
#
|
|
52
|
+
# overrides Base
|
|
53
53
|
private def subtype_of_single?(other)
|
|
54
54
|
case other
|
|
55
55
|
when FixedArray
|
|
@@ -69,7 +69,7 @@ module T::Types
|
|
|
69
69
|
# instead of
|
|
70
70
|
# "Expected [String, Symbol], got Array".
|
|
71
71
|
#
|
|
72
|
-
#
|
|
72
|
+
# overrides Base
|
|
73
73
|
def describe_obj(obj)
|
|
74
74
|
if obj.is_a?(Array)
|
|
75
75
|
if obj.length == @types.length
|
|
@@ -11,12 +11,12 @@ module T::Types
|
|
|
11
11
|
@types = types.transform_values {|v| T::Utils.coerce(v)}
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
#
|
|
14
|
+
# overrides Base
|
|
15
15
|
def name
|
|
16
16
|
serialize_hash(@types)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# overrides Base
|
|
20
20
|
def recursively_valid?(obj)
|
|
21
21
|
return false unless obj.is_a?(Hash)
|
|
22
22
|
return false if @types.any? {|key, type| !type.recursively_valid?(obj[key])}
|
|
@@ -24,7 +24,7 @@ module T::Types
|
|
|
24
24
|
true
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
#
|
|
27
|
+
# overrides Base
|
|
28
28
|
def valid?(obj)
|
|
29
29
|
return false unless obj.is_a?(Hash)
|
|
30
30
|
return false if @types.any? {|key, type| !type.valid?(obj[key])}
|
|
@@ -32,7 +32,7 @@ module T::Types
|
|
|
32
32
|
true
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
#
|
|
35
|
+
# overrides Base
|
|
36
36
|
private def subtype_of_single?(other)
|
|
37
37
|
case other
|
|
38
38
|
when FixedHash
|
|
@@ -44,11 +44,11 @@ module T::Types
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# This gives us better errors, e.g.:
|
|
47
|
-
#
|
|
47
|
+
# `Expected {a: String}, got {a: TrueClass}`
|
|
48
48
|
# instead of
|
|
49
|
-
#
|
|
49
|
+
# `Expected {a: String}, got Hash`.
|
|
50
50
|
#
|
|
51
|
-
#
|
|
51
|
+
# overrides Base
|
|
52
52
|
def describe_obj(obj)
|
|
53
53
|
if obj.is_a?(Hash)
|
|
54
54
|
"type #{serialize_hash(obj.transform_values(&:class))}"
|
|
@@ -18,22 +18,22 @@ module T::Types
|
|
|
18
18
|
end.uniq
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# overrides Base
|
|
22
22
|
def name
|
|
23
23
|
"T.all(#{@types.map(&:name).sort.join(', ')})"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# overrides Base
|
|
27
27
|
def recursively_valid?(obj)
|
|
28
28
|
@types.all? {|type| type.recursively_valid?(obj)}
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# overrides Base
|
|
32
32
|
def valid?(obj)
|
|
33
33
|
@types.all? {|type| type.valid?(obj)}
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
#
|
|
36
|
+
# overrides Base
|
|
37
37
|
private def subtype_of_single?(other)
|
|
38
38
|
raise "This should never be reached if you're going through `subtype_of?` (and you should be)"
|
|
39
39
|
end
|
data/lib/types/types/noreturn.rb
CHANGED
|
@@ -7,17 +7,17 @@ module T::Types
|
|
|
7
7
|
|
|
8
8
|
def initialize; end
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# overrides Base
|
|
11
11
|
def name
|
|
12
12
|
"T.noreturn"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# overrides Base
|
|
16
16
|
def valid?(obj)
|
|
17
17
|
false
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# overrides Base
|
|
21
21
|
private def subtype_of_single?(other)
|
|
22
22
|
true
|
|
23
23
|
end
|
data/lib/types/types/proc.rb
CHANGED
|
@@ -19,7 +19,7 @@ module T::Types
|
|
|
19
19
|
@returns = T::Utils.coerce(returns)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
def name
|
|
24
24
|
args = []
|
|
25
25
|
@arg_types.each do |k, v|
|
|
@@ -28,12 +28,12 @@ module T::Types
|
|
|
28
28
|
"T.proc.params(#{args.join(', ')}).returns(#{returns})"
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# overrides Base
|
|
32
32
|
def valid?(obj)
|
|
33
33
|
obj.is_a?(::Proc)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
#
|
|
36
|
+
# overrides Base
|
|
37
37
|
private def subtype_of_single?(other)
|
|
38
38
|
case other
|
|
39
39
|
when self.class
|
|
@@ -8,17 +8,17 @@ module T::Types
|
|
|
8
8
|
|
|
9
9
|
def initialize(); end
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# overrides Base
|
|
12
12
|
def name
|
|
13
13
|
"T.self_type"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
#
|
|
16
|
+
# overrides Base
|
|
17
17
|
def valid?(obj)
|
|
18
18
|
true
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# overrides Base
|
|
22
22
|
private def subtype_of_single?(other)
|
|
23
23
|
case other
|
|
24
24
|
when SelfType
|
data/lib/types/types/simple.rb
CHANGED
|
@@ -10,7 +10,7 @@ module T::Types
|
|
|
10
10
|
@raw_type = raw_type
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# overrides Base
|
|
14
14
|
def name
|
|
15
15
|
# Memoize to mitigate pathological performance with anonymous modules (https://bugs.ruby-lang.org/issues/11119)
|
|
16
16
|
#
|
|
@@ -19,12 +19,12 @@ module T::Types
|
|
|
19
19
|
@name ||= @raw_type.name.freeze
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
def valid?(obj)
|
|
24
24
|
obj.is_a?(@raw_type)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
#
|
|
27
|
+
# overrides Base
|
|
28
28
|
private def subtype_of_single?(other)
|
|
29
29
|
case other
|
|
30
30
|
when Simple
|
data/lib/types/types/t_enum.rb
CHANGED
|
@@ -10,7 +10,7 @@ module T::Types
|
|
|
10
10
|
@val = val
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# overrides Base
|
|
14
14
|
def name
|
|
15
15
|
# Strips the #<...> off, just leaving the ...
|
|
16
16
|
# Reasoning: the user will have written something like
|
|
@@ -20,12 +20,12 @@ module T::Types
|
|
|
20
20
|
@val.inspect[2..-2]
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# overrides Base
|
|
24
24
|
def valid?(obj)
|
|
25
25
|
@val == obj
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
#
|
|
28
|
+
# overrides Base
|
|
29
29
|
private def subtype_of_single?(other)
|
|
30
30
|
case other
|
|
31
31
|
when TEnum
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
module T::Types
|
|
5
5
|
class TypedArray < TypedEnumerable
|
|
6
|
-
#
|
|
6
|
+
# overrides Base
|
|
7
7
|
def name
|
|
8
8
|
"T::Array[#{@type.name}]"
|
|
9
9
|
end
|
|
@@ -12,12 +12,12 @@ module T::Types
|
|
|
12
12
|
Array
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# overrides Base
|
|
16
16
|
def recursively_valid?(obj)
|
|
17
17
|
obj.is_a?(Array) && super
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# overrides Base
|
|
21
21
|
def valid?(obj)
|
|
22
22
|
obj.is_a?(Array)
|
|
23
23
|
end
|
|
@@ -16,17 +16,17 @@ module T::Types
|
|
|
16
16
|
Enumerable
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# overrides Base
|
|
20
20
|
def name
|
|
21
21
|
"T::Enumerable[#{@type.name}]"
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
#
|
|
24
|
+
# overrides Base
|
|
25
25
|
def valid?(obj)
|
|
26
26
|
obj.is_a?(Enumerable)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# overrides Base
|
|
30
30
|
def recursively_valid?(obj)
|
|
31
31
|
return false unless obj.is_a?(Enumerable)
|
|
32
32
|
case obj
|
|
@@ -74,7 +74,7 @@ module T::Types
|
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
#
|
|
77
|
+
# overrides Base
|
|
78
78
|
private def subtype_of_single?(other)
|
|
79
79
|
if other.class <= TypedEnumerable &&
|
|
80
80
|
underlying_class <= other.underlying_class
|
|
@@ -90,7 +90,7 @@ module T::Types
|
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
#
|
|
93
|
+
# overrides Base
|
|
94
94
|
def describe_obj(obj)
|
|
95
95
|
return super unless obj.is_a?(Enumerable)
|
|
96
96
|
type_from_instance(obj).name
|
|
@@ -9,17 +9,17 @@ module T::Types
|
|
|
9
9
|
Enumerator
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
#
|
|
12
|
+
# overrides Base
|
|
13
13
|
def name
|
|
14
14
|
"T::Enumerator[#{@type.name}]"
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# overrides Base
|
|
18
18
|
def recursively_valid?(obj)
|
|
19
19
|
obj.is_a?(Enumerator) && super
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
def valid?(obj)
|
|
24
24
|
obj.is_a?(Enumerator)
|
|
25
25
|
end
|
|
@@ -16,17 +16,17 @@ module T::Types
|
|
|
16
16
|
@type = T::Utils.coerce([keys, values])
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# overrides Base
|
|
20
20
|
def name
|
|
21
21
|
"T::Hash[#{@keys.name}, #{@values.name}]"
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
#
|
|
24
|
+
# overrides Base
|
|
25
25
|
def recursively_valid?(obj)
|
|
26
26
|
obj.is_a?(Hash) && super
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# overrides Base
|
|
30
30
|
def valid?(obj)
|
|
31
31
|
obj.is_a?(Hash)
|
|
32
32
|
end
|
|
@@ -9,17 +9,17 @@ module T::Types
|
|
|
9
9
|
Hash
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
#
|
|
12
|
+
# overrides Base
|
|
13
13
|
def name
|
|
14
14
|
"T::Range[#{@type.name}]"
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# overrides Base
|
|
18
18
|
def recursively_valid?(obj)
|
|
19
19
|
obj.is_a?(Range) && super
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
def valid?(obj)
|
|
24
24
|
obj.is_a?(Range)
|
|
25
25
|
end
|
|
@@ -9,17 +9,17 @@ module T::Types
|
|
|
9
9
|
Hash
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
#
|
|
12
|
+
# overrides Base
|
|
13
13
|
def name
|
|
14
14
|
"T::Set[#{@type.name}]"
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# overrides Base
|
|
18
18
|
def recursively_valid?(obj)
|
|
19
19
|
obj.is_a?(Set) && super
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# overrides Base
|
|
23
23
|
def valid?(obj)
|
|
24
24
|
obj.is_a?(Set)
|
|
25
25
|
end
|
data/lib/types/types/union.rb
CHANGED
|
@@ -18,7 +18,7 @@ module T::Types
|
|
|
18
18
|
end.uniq
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# overrides Base
|
|
22
22
|
def name
|
|
23
23
|
type_shortcuts(@types)
|
|
24
24
|
end
|
|
@@ -42,17 +42,17 @@ module T::Types
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
#
|
|
45
|
+
# overrides Base
|
|
46
46
|
def recursively_valid?(obj)
|
|
47
47
|
@types.any? {|type| type.recursively_valid?(obj)}
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
#
|
|
50
|
+
# overrides Base
|
|
51
51
|
def valid?(obj)
|
|
52
52
|
@types.any? {|type| type.valid?(obj)}
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
#
|
|
55
|
+
# overrides Base
|
|
56
56
|
private def subtype_of_single?(other)
|
|
57
57
|
raise "This should never be reached if you're going through `subtype_of?` (and you should be)"
|
|
58
58
|
end
|
data/lib/types/types/untyped.rb
CHANGED
|
@@ -7,17 +7,17 @@ module T::Types
|
|
|
7
7
|
|
|
8
8
|
def initialize; end
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# overrides Base
|
|
11
11
|
def name
|
|
12
12
|
"T.untyped"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# overrides Base
|
|
16
16
|
def valid?(obj)
|
|
17
17
|
true
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# overrides Base
|
|
21
21
|
private def subtype_of_single?(other)
|
|
22
22
|
true
|
|
23
23
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sorbet-runtime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.9182
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|