sorbet-runtime 0.5.11366 → 0.5.11367
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/enum.rb +24 -24
- 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: 881e490bb87977bd916c6d97efc687dbb7e2003fe09df47c9ad1a59d3bee1e55
|
4
|
+
data.tar.gz: 4a44dbb7e0d04d2f76db31ca6e124cf4af3ab675acd825556a8f7ade189afb7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72d452546dd877152d77b4a63be90f5c2945f0c4640635d089b4f128c946bef49979083e02af45ddc390e047d70f36e29c016253bd8af3b34ce977ee1bf20010
|
7
|
+
data.tar.gz: 260e78af30a3bb7c6c261535567d0583afac154fe05f3876f8d6ab30f21dc3109417b57462a5bff2a3b18216be24bd82ac1c010e5b26eefe86c87b24e752cf85
|
data/lib/types/enum.rb
CHANGED
@@ -185,6 +185,30 @@ class T::Enum
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
+
# NB: Do not call this method. This exists to allow for a safe migration path in places where enum
|
189
|
+
# values are compared directly against string values.
|
190
|
+
#
|
191
|
+
# Ruby's string has a weird quirk where `'my_string' == obj` calls obj.==('my_string') if obj
|
192
|
+
# responds to the `to_str` method. It does not actually call `to_str` however.
|
193
|
+
#
|
194
|
+
# See https://ruby-doc.org/core-2.4.0/String.html#method-i-3D-3D
|
195
|
+
T::Sig::WithoutRuntime.sig {returns(String)}
|
196
|
+
def to_str
|
197
|
+
msg = 'Implicit conversion of Enum instances to strings is not allowed. Call #serialize instead.'
|
198
|
+
if T::Configuration.legacy_t_enum_migration_mode?
|
199
|
+
T::Configuration.soft_assert_handler(
|
200
|
+
msg,
|
201
|
+
storytime: {
|
202
|
+
class: self.class.name,
|
203
|
+
caller_location: Kernel.caller_locations(1..1)&.[](0)&.then {"#{_1.path}:#{_1.lineno}"},
|
204
|
+
},
|
205
|
+
)
|
206
|
+
serialize.to_s
|
207
|
+
else
|
208
|
+
Kernel.raise NoMethodError.new(msg)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
188
212
|
module LegacyMigrationMode
|
189
213
|
include Kernel
|
190
214
|
extend T::Helpers
|
@@ -197,30 +221,6 @@ class T::Enum
|
|
197
221
|
def serialize; end
|
198
222
|
end
|
199
223
|
|
200
|
-
# NB: Do not call this method. This exists to allow for a safe migration path in places where enum
|
201
|
-
# values are compared directly against string values.
|
202
|
-
#
|
203
|
-
# Ruby's string has a weird quirk where `'my_string' == obj` calls obj.==('my_string') if obj
|
204
|
-
# responds to the `to_str` method. It does not actually call `to_str` however.
|
205
|
-
#
|
206
|
-
# See https://ruby-doc.org/core-2.4.0/String.html#method-i-3D-3D
|
207
|
-
T::Sig::WithoutRuntime.sig {returns(String)}
|
208
|
-
def to_str
|
209
|
-
msg = 'Implicit conversion of Enum instances to strings is not allowed. Call #serialize instead.'
|
210
|
-
if T::Configuration.legacy_t_enum_migration_mode?
|
211
|
-
T::Configuration.soft_assert_handler(
|
212
|
-
msg,
|
213
|
-
storytime: {
|
214
|
-
class: self.class.name,
|
215
|
-
caller_location: Kernel.caller_locations(1..1)&.[](0)&.then {"#{_1.path}:#{_1.lineno}"},
|
216
|
-
},
|
217
|
-
)
|
218
|
-
serialize.to_s
|
219
|
-
else
|
220
|
-
Kernel.raise NoMethodError.new(msg)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
224
|
# WithoutRuntime so that comparison_assertion_failed can assume a constant stack depth
|
225
225
|
T::Sig::WithoutRuntime.sig {params(other: BasicObject).returns(T::Boolean)}
|
226
226
|
def ==(other)
|
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.11367
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|