sorbet-runtime 0.6.12638 → 0.6.12642
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/private/methods/_methods.rb +32 -33
- 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: 8b84ebdad365ea213b1f887ff519f7f6e626583b8c783b74d97156efa85e7b8e
|
4
|
+
data.tar.gz: 25c8348e3ad9d57cd6654ff379f91210216e4156c9f96c05f3080daad9fd5a51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dafa585ddb7eedd25eec2240d4d58d9d1ccd3e2c22a69a84aa90533a70488349eca67052da68386bbdcba5097c5f0d6020fdf7a31809f42c08fe354a1f1e8897
|
7
|
+
data.tar.gz: d6fd8748f21ffc7b91b0cc4dccfb2a0b73d69e0eb5a98a41ee71f249ca635c15743df1f38b8cad8093657dbc9693ddf60289ae91b09b35528f949c432781c447
|
@@ -104,24 +104,6 @@ module T::Private::Methods
|
|
104
104
|
T::Types::Proc.new(decl.params, decl.returns)
|
105
105
|
end
|
106
106
|
|
107
|
-
# Returns the signature for a method whose definition was preceded by `sig`.
|
108
|
-
#
|
109
|
-
# @param method [UnboundMethod]
|
110
|
-
# @return [T::Private::Methods::Signature]
|
111
|
-
def self.signature_for_method(method)
|
112
|
-
signature_for_key(method_to_key(method))
|
113
|
-
end
|
114
|
-
|
115
|
-
private_class_method def self.signature_for_key(key)
|
116
|
-
maybe_run_sig_block_for_key(key)
|
117
|
-
|
118
|
-
# If a subclass Sub inherits a method `foo` from Base, then
|
119
|
-
# Sub.instance_method(:foo) != Base.instance_method(:foo) even though they resolve to the
|
120
|
-
# same method. Similarly, Foo.method(:bar) != Foo.singleton_class.instance_method(:bar).
|
121
|
-
# So, we always do the look up by the method on the owner (Base in this example).
|
122
|
-
@signatures_by_method[key]
|
123
|
-
end
|
124
|
-
|
125
107
|
# Fetch the directory name of the file that defines the `T::Private` constant and
|
126
108
|
# add a trailing slash to allow us to match it as a directory prefix.
|
127
109
|
SORBET_RUNTIME_LIB_PATH = File.dirname(T.const_source_location(:Private).first) + File::SEPARATOR
|
@@ -407,6 +389,19 @@ module T::Private::Methods
|
|
407
389
|
end
|
408
390
|
end
|
409
391
|
|
392
|
+
# Returns the signature for a method whose definition was preceded by `sig`.
|
393
|
+
#
|
394
|
+
# @param method [UnboundMethod]
|
395
|
+
# @return [T::Private::Methods::Signature]
|
396
|
+
def self.signature_for_method(method)
|
397
|
+
signature_for_key(method_to_key(method))
|
398
|
+
end
|
399
|
+
|
400
|
+
private_class_method def self.signature_for_key(key)
|
401
|
+
maybe_run_sig_block_for_key(key)
|
402
|
+
@signatures_by_method[key]
|
403
|
+
end
|
404
|
+
|
410
405
|
def self.unwrap_method(mod, signature, original_method)
|
411
406
|
maybe_wrapped_method = CallValidation.wrap_method_if_needed(mod, signature, original_method)
|
412
407
|
@signatures_by_method[method_to_key(maybe_wrapped_method)] = signature
|
@@ -433,6 +428,25 @@ module T::Private::Methods
|
|
433
428
|
run_sig_block_for_key(method_to_key(method))
|
434
429
|
end
|
435
430
|
|
431
|
+
# use this directly if you don't want/need to box up the method into an object to pass to method_to_key.
|
432
|
+
private_class_method def self.method_owner_and_name_to_key(owner, name)
|
433
|
+
"#{owner.object_id}##{name}"
|
434
|
+
end
|
435
|
+
|
436
|
+
private_class_method def self.method_to_key(method)
|
437
|
+
# If a subclass Sub inherits a method `foo` from Base, then
|
438
|
+
# Sub.instance_method(:foo) != Base.instance_method(:foo) even though they resolve to the
|
439
|
+
# same method. Similarly, Foo.method(:bar) != Foo.singleton_class.instance_method(:bar).
|
440
|
+
# So, we always do the look up by the method on the owner (Base in this example).
|
441
|
+
method_owner_and_name_to_key(method.owner, method.name)
|
442
|
+
end
|
443
|
+
|
444
|
+
private_class_method def self.key_to_method(key)
|
445
|
+
id, name = key.split("#")
|
446
|
+
obj = ObjectSpace._id2ref(id.to_i)
|
447
|
+
obj.instance_method(name)
|
448
|
+
end
|
449
|
+
|
436
450
|
private_class_method def self.run_sig_block_for_key(key, force_type_init: false)
|
437
451
|
blk = @sig_wrappers[key]
|
438
452
|
if !blk
|
@@ -604,21 +618,6 @@ module T::Private::Methods
|
|
604
618
|
mod.method(name)
|
605
619
|
end
|
606
620
|
end
|
607
|
-
|
608
|
-
# use this directly if you don't want/need to box up the method into an object to pass to method_to_key.
|
609
|
-
private_class_method def self.method_owner_and_name_to_key(owner, name)
|
610
|
-
"#{owner.object_id}##{name}"
|
611
|
-
end
|
612
|
-
|
613
|
-
private_class_method def self.method_to_key(method)
|
614
|
-
method_owner_and_name_to_key(method.owner, method.name)
|
615
|
-
end
|
616
|
-
|
617
|
-
private_class_method def self.key_to_method(key)
|
618
|
-
id, name = key.split("#")
|
619
|
-
obj = ObjectSpace._id2ref(id.to_i)
|
620
|
-
obj.instance_method(name)
|
621
|
-
end
|
622
621
|
end
|
623
622
|
|
624
623
|
# This has to be here, and can't be nested inside `T::Private::Methods`,
|
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.6.
|
4
|
+
version: 0.6.12642
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-10-
|
11
|
+
date: 2025-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|