sorbet-runtime 0.5.9019 → 0.5.9030
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/types/simple.rb +10 -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: dcabd0252adda99a045ea1dc30d52b3c2e1b18d26273d8f52c915a7744cebc3f
|
4
|
+
data.tar.gz: c89462c55b2113cc37520e8cec5f6d4adda069ef179bf6a027f5ccae1c965598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7bdd7617d7f56ef075dd813c96ecfd6e6961e41b563e49e4cbc39b267175f7d22d05a3857d8b33ddeee3cd05532cfda1c7145cba5764991ff736c371da07694
|
7
|
+
data.tar.gz: 385c661966297c644fd0fd89b1b8e016a497ee8aadfbeaeb0ca2cb1fdf14c3b8824846a0b0f9e4103e2c0e445c6963f4a97e9a49a262809323b0c38545259c62
|
data/lib/types/types/simple.rb
CHANGED
@@ -40,8 +40,10 @@ module T::Types
|
|
40
40
|
|
41
41
|
module Private
|
42
42
|
module Pool
|
43
|
+
@cache = ObjectSpace::WeakMap.new
|
44
|
+
|
43
45
|
def self.type_for_module(mod)
|
44
|
-
cached = mod
|
46
|
+
cached = @cache[mod]
|
45
47
|
return cached if cached
|
46
48
|
|
47
49
|
type = if mod == ::Array
|
@@ -60,7 +62,13 @@ module T::Types
|
|
60
62
|
Simple.new(mod)
|
61
63
|
end
|
62
64
|
|
63
|
-
|
65
|
+
# Unfortunately, we still need to check if the module is frozen,
|
66
|
+
# since WeakMap adds a finalizer to the key that is added
|
67
|
+
# to the map, so that it can clear the map entry when the key is
|
68
|
+
# garbage collected.
|
69
|
+
# For a frozen object, though, adding a finalizer is not a valid
|
70
|
+
# operation, so this still raises if `mod` is frozen.
|
71
|
+
@cache[mod] = type unless mod.frozen?
|
64
72
|
type
|
65
73
|
end
|
66
74
|
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.9030
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|