sorbet-runtime 0.5.5400 → 0.5.5403
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/props/private/setter_factory.rb +8 -6
- 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: f473428349c55b787d0d32060bf8a78448adf9a1133f0c8e20f817b83e7d4c58
|
4
|
+
data.tar.gz: 434b145981f510ef0148a270ec5227fcfb8d1c741e4e9eb26ebf0ebc1e665c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9de7bf33a67fb9f5dbdb430138eae9ebbcfe2ecda211419728948f7f8095cc26ca97927886fc23378a24da62e0324480101e4ea9a153e4b0e45e3b97fda3cd44
|
7
|
+
data.tar.gz: 15b30b2ea60102d219e53d774aea7bfc56277bee5616a5a24f3bb47a774a6ec8e9cf02c6addadc390e8a40cec86619e69aa319f0b8086ad2236209e895405b62
|
@@ -39,9 +39,9 @@ module T::Props
|
|
39
39
|
# Use separate methods in order to ensure that we only close over necessary
|
40
40
|
# variables
|
41
41
|
if !T::Props::Utils.need_nil_write_check?(rules) || has_explicit_nil_default
|
42
|
-
nilable_proc(prop, accessor_key, non_nil_type)
|
42
|
+
nilable_proc(prop, accessor_key, non_nil_type, klass)
|
43
43
|
else
|
44
|
-
non_nil_proc(prop, accessor_key, non_nil_type)
|
44
|
+
non_nil_proc(prop, accessor_key, non_nil_type, klass)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -50,16 +50,17 @@ module T::Props
|
|
50
50
|
prop: Symbol,
|
51
51
|
accessor_key: Symbol,
|
52
52
|
non_nil_type: T.any(T::Types::Base, T.all(T::Props::CustomType, Module)),
|
53
|
+
klass: T.all(Module, T::Props::ClassMethods),
|
53
54
|
)
|
54
55
|
.returns(SetterProc)
|
55
56
|
end
|
56
|
-
private_class_method def self.non_nil_proc(prop, accessor_key, non_nil_type)
|
57
|
+
private_class_method def self.non_nil_proc(prop, accessor_key, non_nil_type, klass)
|
57
58
|
proc do |val|
|
58
59
|
if non_nil_type.valid?(val)
|
59
60
|
instance_variable_set(accessor_key, val)
|
60
61
|
else
|
61
62
|
T::Props::Private::SetterFactory.raise_pretty_error(
|
62
|
-
|
63
|
+
klass,
|
63
64
|
prop,
|
64
65
|
non_nil_type,
|
65
66
|
val,
|
@@ -73,10 +74,11 @@ module T::Props
|
|
73
74
|
prop: Symbol,
|
74
75
|
accessor_key: Symbol,
|
75
76
|
non_nil_type: T.any(T::Types::Base, T.all(T::Props::CustomType, Module)),
|
77
|
+
klass: T.all(Module, T::Props::ClassMethods),
|
76
78
|
)
|
77
79
|
.returns(SetterProc)
|
78
80
|
end
|
79
|
-
private_class_method def self.nilable_proc(prop, accessor_key, non_nil_type)
|
81
|
+
private_class_method def self.nilable_proc(prop, accessor_key, non_nil_type, klass)
|
80
82
|
proc do |val|
|
81
83
|
if val.nil?
|
82
84
|
instance_variable_set(accessor_key, nil)
|
@@ -84,7 +86,7 @@ module T::Props
|
|
84
86
|
instance_variable_set(accessor_key, val)
|
85
87
|
else
|
86
88
|
T::Props::Private::SetterFactory.raise_pretty_error(
|
87
|
-
|
89
|
+
klass,
|
88
90
|
prop,
|
89
91
|
non_nil_type,
|
90
92
|
val,
|
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.5403
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|