sorbet-runtime 0.5.6393 → 0.5.6395
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.rb +19 -0
- 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: a3f7e712765bc8cf3eb2bb0677e1a9bc7c076ccd0a45ec264dea11fa45a0602b
|
4
|
+
data.tar.gz: aa45bd7ec5aa309fd5431992dd240f0558f37806b721a9f266b544492b34351c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ce05d54623d9e6961f5af4e8efe72a2be490c847da79719bc4dfbd38b2ddfd49a3ed24341c14b13fff4f3b32c03742788f7ee4b50ab69cf5204b2c86d4d2da
|
7
|
+
data.tar.gz: 421508b1b085f4d3a111a961ae56cbc2afc92c5077fa81c7560c952d92d32458172336e52091b8d1ff1aff7635e592765f526d79e7885bf97a1666a79e9b039b
|
data/lib/types/_types.rb
CHANGED
@@ -147,6 +147,25 @@ module T
|
|
147
147
|
Private::Casts.cast(value, type, cast_method: "T.let")
|
148
148
|
end
|
149
149
|
|
150
|
+
# Tells the type checker to treat `self` in the current block as `type`.
|
151
|
+
# Useful for blocks that are captured and executed later with instance_exec.
|
152
|
+
# Use like:
|
153
|
+
#
|
154
|
+
# seconds = lambda do
|
155
|
+
# T.bind(self, NewBinding)
|
156
|
+
# ...
|
157
|
+
# end
|
158
|
+
#
|
159
|
+
# `T.bind` behaves like `T.cast` in that it is assumed to be true statically.
|
160
|
+
#
|
161
|
+
# If `checked` is true, raises an exception at runtime if the value
|
162
|
+
# doesn't match the type (this is the default).
|
163
|
+
def self.bind(value, type, checked: true)
|
164
|
+
return value unless checked
|
165
|
+
|
166
|
+
Private::Casts.cast(value, type, cast_method: "T.bind")
|
167
|
+
end
|
168
|
+
|
150
169
|
# Tells the typechecker to ensure that `value` is of type `type` (if not, the typechecker will
|
151
170
|
# fail). Use this for debugging typechecking errors, or to ensure that type information is
|
152
171
|
# statically known and being checked appropriately. If `checked` is true, raises an exception at
|
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.6395
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|