sorbet-runtime 0.6.12753 → 0.6.12768
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/enum.rb +1 -1
- data/lib/types/props/custom_type.rb +1 -1
- data/lib/types/props/decorator.rb +14 -12
- data/lib/types/props/private/apply_default.rb +4 -4
- data/lib/types/props/private/serde_transform.rb +4 -4
- data/lib/types/props/private/setter_factory.rb +9 -9
- data/lib/types/props/type_validation.rb +2 -2
- 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: 617855ac701ca8f1fc03e7a60d25e977dea2cb2599b52815515e3c4bf73a811f
|
|
4
|
+
data.tar.gz: 730e473ff7ab33b2c49c32b4dfdbc70148a8e7b819cfbbb557d9b65e475a9b4b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8568fdf0b66d2bccacf7ea166f3750de035b9d557e988813ea4dc6b643f298ae28fc9fa28ea3ee642fa9a16a81ffc43c5fdcdaffeb1114f648482030ea68ab9f
|
|
7
|
+
data.tar.gz: ba775c9999fdec9e8d05c2452f9792270b6cd8dd12d7c1e9f3ba535c253ceca92c261473f5384a350b306471267c2e7851b44939508cf1cdbbcaf18f36ee8339
|
data/lib/types/enum.rb
CHANGED
|
@@ -50,7 +50,7 @@ module T::Props
|
|
|
50
50
|
sig { abstract.params(scalar: T.untyped).returns(T.untyped).checked(:never) }
|
|
51
51
|
def deserialize(scalar); end
|
|
52
52
|
|
|
53
|
-
sig { override.params(_base: Module).void }
|
|
53
|
+
sig { override.params(_base: T::Module[T.anything]).void }
|
|
54
54
|
def self.included(_base)
|
|
55
55
|
super
|
|
56
56
|
|
|
@@ -13,8 +13,10 @@ class T::Props::Decorator
|
|
|
13
13
|
Rules = T.type_alias { T::Hash[Symbol, T.untyped] }
|
|
14
14
|
DecoratedInstance = T.type_alias { Object } # Would be T::Props, but that produces circular reference errors in some circumstances
|
|
15
15
|
PropType = T.type_alias { T::Types::Base }
|
|
16
|
-
PropTypeOrClass = T.type_alias { T.any(PropType, Module) }
|
|
16
|
+
PropTypeOrClass = T.type_alias { T.any(PropType, T::Module[T.anything]) }
|
|
17
17
|
OverrideRules = T.type_alias { T::Hash[Symbol, {allow_incompatible: T::Boolean}] }
|
|
18
|
+
DecoratedClassType = T.type_alias { T.all(T::Module[T.anything], T::Props::ClassMethods) }
|
|
19
|
+
private_constant :DecoratedClassType
|
|
18
20
|
|
|
19
21
|
class NoRulesError < StandardError; end
|
|
20
22
|
|
|
@@ -38,7 +40,7 @@ class T::Props::Decorator
|
|
|
38
40
|
|
|
39
41
|
sig { params(klass: T.untyped).void.checked(:never) }
|
|
40
42
|
def initialize(klass)
|
|
41
|
-
@class = T.let(klass,
|
|
43
|
+
@class = T.let(klass, DecoratedClassType)
|
|
42
44
|
@class.plugins.each do |mod|
|
|
43
45
|
T::Props::Plugin::Private.apply_decorator_methods(mod, self)
|
|
44
46
|
end
|
|
@@ -102,7 +104,7 @@ class T::Props::Decorator
|
|
|
102
104
|
end
|
|
103
105
|
|
|
104
106
|
# checked(:never) - O(prop accesses)
|
|
105
|
-
sig { returns(
|
|
107
|
+
sig { returns(DecoratedClassType).checked(:never) }
|
|
106
108
|
def decorated_class
|
|
107
109
|
@class
|
|
108
110
|
end
|
|
@@ -207,7 +209,7 @@ class T::Props::Decorator
|
|
|
207
209
|
params(
|
|
208
210
|
instance: DecoratedInstance,
|
|
209
211
|
prop: Symbol,
|
|
210
|
-
foreign_class: Module,
|
|
212
|
+
foreign_class: T::Module[T.anything],
|
|
211
213
|
rules: Rules,
|
|
212
214
|
opts: T::Hash[Symbol, T.untyped],
|
|
213
215
|
)
|
|
@@ -226,7 +228,7 @@ class T::Props::Decorator
|
|
|
226
228
|
sig do
|
|
227
229
|
params(
|
|
228
230
|
name: Symbol,
|
|
229
|
-
cls: Module,
|
|
231
|
+
cls: T::Module[T.anything],
|
|
230
232
|
rules: Rules,
|
|
231
233
|
type: PropTypeOrClass
|
|
232
234
|
)
|
|
@@ -277,7 +279,7 @@ class T::Props::Decorator
|
|
|
277
279
|
end
|
|
278
280
|
|
|
279
281
|
# This converts the type from a T::Type to a regular old ruby class.
|
|
280
|
-
sig { params(type: T::Types::Base).returns(Module).checked(:never) }
|
|
282
|
+
sig { params(type: T::Types::Base).returns(T::Module[T.anything]).checked(:never) }
|
|
281
283
|
private def convert_type_to_class(type)
|
|
282
284
|
case type
|
|
283
285
|
when T::Types::TypedArray, T::Types::FixedArray
|
|
@@ -586,7 +588,7 @@ class T::Props::Decorator
|
|
|
586
588
|
sig do
|
|
587
589
|
params(
|
|
588
590
|
prop_name: Symbol,
|
|
589
|
-
prop_cls: Module,
|
|
591
|
+
prop_cls: T::Module[T.anything],
|
|
590
592
|
rules: Rules,
|
|
591
593
|
foreign: T.untyped,
|
|
592
594
|
)
|
|
@@ -629,10 +631,10 @@ class T::Props::Decorator
|
|
|
629
631
|
#
|
|
630
632
|
# This gets called when a module or class that extends T::Props gets included, extended,
|
|
631
633
|
# prepended, or inherited.
|
|
632
|
-
sig { params(child: Module).void.checked(:never) }
|
|
634
|
+
sig { params(child: T::Module[T.anything]).void.checked(:never) }
|
|
633
635
|
def model_inherited(child)
|
|
634
636
|
child.extend(T::Props::ClassMethods)
|
|
635
|
-
child = T.cast(child,
|
|
637
|
+
child = T.cast(child, DecoratedClassType)
|
|
636
638
|
|
|
637
639
|
child.plugins.concat(decorated_class.plugins)
|
|
638
640
|
decorated_class.plugins.each do |mod|
|
|
@@ -719,19 +721,19 @@ class T::Props::Decorator
|
|
|
719
721
|
result
|
|
720
722
|
end
|
|
721
723
|
|
|
722
|
-
sig { params(child:
|
|
724
|
+
sig { params(child: DecoratedClassType, prop: Symbol).returns(T::Boolean).checked(:never) }
|
|
723
725
|
private def clobber_getter?(child, prop)
|
|
724
726
|
!!(child.decorator.method(:prop_get).owner != method(:prop_get).owner &&
|
|
725
727
|
child.instance_method(prop).source_location&.first == __FILE__)
|
|
726
728
|
end
|
|
727
729
|
|
|
728
|
-
sig { params(child:
|
|
730
|
+
sig { params(child: DecoratedClassType, prop: Symbol).returns(T::Boolean).checked(:never) }
|
|
729
731
|
private def clobber_setter?(child, prop)
|
|
730
732
|
!!(child.decorator.method(:prop_set).owner != method(:prop_set).owner &&
|
|
731
733
|
child.instance_method("#{prop}=").source_location&.first == __FILE__)
|
|
732
734
|
end
|
|
733
735
|
|
|
734
|
-
sig { params(mod: Module).void.checked(:never) }
|
|
736
|
+
sig { params(mod: T::Module[T.anything]).void.checked(:never) }
|
|
735
737
|
def plugin(mod)
|
|
736
738
|
decorated_class.plugins << mod
|
|
737
739
|
T::Props::Plugin::Private.apply_class_methods(mod, decorated_class)
|
|
@@ -27,10 +27,10 @@ module T::Props
|
|
|
27
27
|
sig { abstract.params(instance: T.all(T::Props::Optional, Object)).void.checked(:never) }
|
|
28
28
|
def set_default(instance); end
|
|
29
29
|
|
|
30
|
-
NO_CLONE_TYPES = T.let([TrueClass, FalseClass, NilClass, Symbol, Numeric, T::Enum].freeze, T::Array[Module])
|
|
30
|
+
NO_CLONE_TYPES = T.let([TrueClass, FalseClass, NilClass, Symbol, Numeric, T::Enum].freeze, T::Array[T::Module[T.anything]])
|
|
31
31
|
|
|
32
32
|
# checked(:never) - Rules hash is expensive to check
|
|
33
|
-
sig { params(cls: Module, rules: T::Hash[Symbol, T.untyped]).returns(T.nilable(ApplyDefault)).checked(:never) }
|
|
33
|
+
sig { params(cls: T::Module[T.anything], rules: T::Hash[Symbol, T.untyped]).returns(T.nilable(ApplyDefault)).checked(:never) }
|
|
34
34
|
def self.for(cls, rules)
|
|
35
35
|
accessor_key = rules.fetch(:accessor_key)
|
|
36
36
|
setter = rules.fetch(:setter_proc)
|
|
@@ -138,7 +138,7 @@ module T::Props
|
|
|
138
138
|
# checked(:never) - We do this with `T.let` instead
|
|
139
139
|
sig do
|
|
140
140
|
params(
|
|
141
|
-
cls: Module,
|
|
141
|
+
cls: T::Module[T.anything],
|
|
142
142
|
factory: T.any(Proc, Method),
|
|
143
143
|
accessor_key: Symbol,
|
|
144
144
|
setter_proc: SetterFactory::SetterProc,
|
|
@@ -147,7 +147,7 @@ module T::Props
|
|
|
147
147
|
.checked(:never)
|
|
148
148
|
end
|
|
149
149
|
def initialize(cls, factory, accessor_key, setter_proc)
|
|
150
|
-
@class = T.let(cls, Module)
|
|
150
|
+
@class = T.let(cls, T::Module[T.anything])
|
|
151
151
|
@factory = T.let(factory, T.any(Proc, Method))
|
|
152
152
|
super(accessor_key, setter_proc)
|
|
153
153
|
end
|
|
@@ -20,7 +20,7 @@ module T::Props
|
|
|
20
20
|
|
|
21
21
|
NO_TRANSFORM_TYPES = T.let(
|
|
22
22
|
[TrueClass, FalseClass, NilClass, Symbol, String].freeze,
|
|
23
|
-
T::Array[Module],
|
|
23
|
+
T::Array[T::Module[T.anything]],
|
|
24
24
|
)
|
|
25
25
|
private_constant :NO_TRANSFORM_TYPES
|
|
26
26
|
|
|
@@ -151,7 +151,7 @@ module T::Props
|
|
|
151
151
|
end
|
|
152
152
|
end
|
|
153
153
|
|
|
154
|
-
sig { params(varname: String, type: Module, mode: ModeType).returns(String).checked(:never) }
|
|
154
|
+
sig { params(varname: String, type: T::Module[T.anything], mode: ModeType).returns(String).checked(:never) }
|
|
155
155
|
private_class_method def self.handle_serializable_subtype(varname, type, mode)
|
|
156
156
|
case mode
|
|
157
157
|
when Serialize
|
|
@@ -164,7 +164,7 @@ module T::Props
|
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
-
sig { params(varname: String, type: Module, mode: ModeType).returns(String).checked(:never) }
|
|
167
|
+
sig { params(varname: String, type: T::Module[T.anything], mode: ModeType).returns(String).checked(:never) }
|
|
168
168
|
private_class_method def self.handle_custom_type(varname, type, mode)
|
|
169
169
|
case mode
|
|
170
170
|
when Serialize
|
|
@@ -177,7 +177,7 @@ module T::Props
|
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
-
sig { params(type: Module).returns(T.nilable(String)).checked(:never) }
|
|
180
|
+
sig { params(type: T::Module[T.anything]).returns(T.nilable(String)).checked(:never) }
|
|
181
181
|
private_class_method def self.module_name(type)
|
|
182
182
|
T::Configuration.module_name_mangler.call(type)
|
|
183
183
|
end
|
|
@@ -12,7 +12,7 @@ module T::Props
|
|
|
12
12
|
|
|
13
13
|
sig do
|
|
14
14
|
params(
|
|
15
|
-
klass: T.all(Module, T::Props::ClassMethods),
|
|
15
|
+
klass: T.all(T::Module[T.anything], T::Props::ClassMethods),
|
|
16
16
|
prop: Symbol,
|
|
17
17
|
rules: T::Hash[Symbol, T.untyped]
|
|
18
18
|
)
|
|
@@ -53,8 +53,8 @@ module T::Props
|
|
|
53
53
|
params(
|
|
54
54
|
prop: Symbol,
|
|
55
55
|
accessor_key: Symbol,
|
|
56
|
-
non_nil_type: Module,
|
|
57
|
-
klass: T.all(Module, T::Props::ClassMethods),
|
|
56
|
+
non_nil_type: T::Module[T.anything],
|
|
57
|
+
klass: T.all(T::Module[T.anything], T::Props::ClassMethods),
|
|
58
58
|
)
|
|
59
59
|
.returns([SetterProc, ValueValidationProc])
|
|
60
60
|
end
|
|
@@ -89,7 +89,7 @@ module T::Props
|
|
|
89
89
|
prop: Symbol,
|
|
90
90
|
accessor_key: Symbol,
|
|
91
91
|
non_nil_type: T::Types::Base,
|
|
92
|
-
klass: T.all(Module, T::Props::ClassMethods),
|
|
92
|
+
klass: T.all(T::Module[T.anything], T::Props::ClassMethods),
|
|
93
93
|
validate: T.nilable(ValidateProc)
|
|
94
94
|
)
|
|
95
95
|
.returns([SetterProc, ValueValidationProc])
|
|
@@ -138,8 +138,8 @@ module T::Props
|
|
|
138
138
|
params(
|
|
139
139
|
prop: Symbol,
|
|
140
140
|
accessor_key: Symbol,
|
|
141
|
-
non_nil_type: Module,
|
|
142
|
-
klass: T.all(Module, T::Props::ClassMethods),
|
|
141
|
+
non_nil_type: T::Module[T.anything],
|
|
142
|
+
klass: T.all(T::Module[T.anything], T::Props::ClassMethods),
|
|
143
143
|
)
|
|
144
144
|
.returns([SetterProc, ValueValidationProc])
|
|
145
145
|
end
|
|
@@ -174,7 +174,7 @@ module T::Props
|
|
|
174
174
|
prop: Symbol,
|
|
175
175
|
accessor_key: Symbol,
|
|
176
176
|
non_nil_type: T::Types::Base,
|
|
177
|
-
klass: T.all(Module, T::Props::ClassMethods),
|
|
177
|
+
klass: T.all(T::Module[T.anything], T::Props::ClassMethods),
|
|
178
178
|
validate: T.nilable(ValidateProc),
|
|
179
179
|
)
|
|
180
180
|
.returns([SetterProc, ValueValidationProc])
|
|
@@ -225,9 +225,9 @@ module T::Props
|
|
|
225
225
|
|
|
226
226
|
sig do
|
|
227
227
|
params(
|
|
228
|
-
klass: T.all(Module, T::Props::ClassMethods),
|
|
228
|
+
klass: T.all(T::Module[T.anything], T::Props::ClassMethods),
|
|
229
229
|
prop: Symbol,
|
|
230
|
-
type: T.any(T::Types::Base, Module),
|
|
230
|
+
type: T.any(T::Types::Base, T::Module[T.anything]),
|
|
231
231
|
val: T.untyped,
|
|
232
232
|
)
|
|
233
233
|
.void
|
|
@@ -20,9 +20,9 @@ module T::Props::TypeValidation
|
|
|
20
20
|
sig do
|
|
21
21
|
params(
|
|
22
22
|
name: T.any(Symbol, String),
|
|
23
|
-
_cls: Module,
|
|
23
|
+
_cls: T::Module[T.anything],
|
|
24
24
|
rules: T::Hash[Symbol, T.untyped],
|
|
25
|
-
type: T.any(T::Types::Base, Module)
|
|
25
|
+
type: T.any(T::Types::Base, T::Module[T.anything])
|
|
26
26
|
)
|
|
27
27
|
.void
|
|
28
28
|
.checked(:never)
|
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.6.
|
|
4
|
+
version: 0.6.12768
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|