sorbet-runtime 0.5.11366 → 0.5.11368
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 +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: c3bee9c15570c059f2e8d04bf4c42327453ff5fa3e59f8fed3f79e4111e40439
|
|
4
|
+
data.tar.gz: 1167904b41b53b5dd6112e5cb73525d9fc742814ff553520854807631cb3a728
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4a8e6ce2dc352231e120f6d9170a4ed291e8e5e9ad2c5f5835b212ce3f65788fd3cfec340992efa10ff61c76d89981a8076ad0b0c13235ef353a67d98d762da
|
|
7
|
+
data.tar.gz: 85105fe1a35be2d11ae62ec038736dd1406b71f0d48c79d48f2094230c5d04ce36b728099953f4f37bc5da61ae7fae949740dc4c24ab933a96e9abde4e6ba1eb
|
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.11368
|
|
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-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|