sorbet-runtime 0.5.6346 → 0.5.6349
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/configuration.rb +16 -0
- data/lib/types/private/final.rb +0 -1
- data/lib/types/private/methods/_methods.rb +7 -8
- data/lib/types/props/decorator.rb +5 -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: 37e5c18902b6bf05fda832dcfae31a46dd3ad7c454c7741f7003924c70e351fc
|
|
4
|
+
data.tar.gz: fba7a016bdbc64626802d5ccfdc9cf18ac382936ac7c98dc3bb62b610754a8e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4754a24ac572c182cb80f76c0505e02e61af830e2585cf73b464eba30fe24fc51c9ffeaa2b6ef1ff31a5d3b97e1c70e2d52de6398e924262cbae94e9408334ab
|
|
7
|
+
data.tar.gz: e7120e72312db83159fdde80db0ca357bf526e69fd7d97d5327623b5d3cc1f0c6d76753c25c1fd8ec52542b087a7e17db94e65a4de8c920efbbcff785cd4cdd2
|
data/lib/types/configuration.rb
CHANGED
|
@@ -433,6 +433,22 @@ module T::Configuration
|
|
|
433
433
|
@sensitivity_and_pii_handler
|
|
434
434
|
end
|
|
435
435
|
|
|
436
|
+
@redaction_handler = nil
|
|
437
|
+
# Set to a redaction handling function. This will be called when the
|
|
438
|
+
# `_redacted` version of a prop reader is used. By default this is set to
|
|
439
|
+
# `nil` and will raise an exception when the redacted version of a prop is
|
|
440
|
+
# accessed.
|
|
441
|
+
#
|
|
442
|
+
# @param [Lambda, Proc, nil] value Proc that converts a value into its
|
|
443
|
+
# redacted version according to the spec passed as the second argument.
|
|
444
|
+
def self.redaction_handler=(handler)
|
|
445
|
+
@redaction_handler = handler
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
def self.redaction_handler
|
|
449
|
+
@redaction_handler
|
|
450
|
+
end
|
|
451
|
+
|
|
436
452
|
# Set to a function which can get the 'owner' of a class. This is
|
|
437
453
|
# used in reporting deserialization errors
|
|
438
454
|
#
|
data/lib/types/private/final.rb
CHANGED
|
@@ -37,7 +37,6 @@ module T::Private::Final
|
|
|
37
37
|
mod.extend(mod.is_a?(Class) ? NoInherit : NoIncludeExtend)
|
|
38
38
|
mark_as_final_module(mod)
|
|
39
39
|
mark_as_final_module(mod.singleton_class)
|
|
40
|
-
T::Private::Methods.add_module_with_final(mod)
|
|
41
40
|
T::Private::Methods.install_hooks(mod)
|
|
42
41
|
end
|
|
43
42
|
|
|
@@ -184,11 +184,11 @@ module T::Private::Methods
|
|
|
184
184
|
# Don't compute mod.ancestors if we don't need to bother checking final-ness.
|
|
185
185
|
if was_ever_final?(method_name) && module_with_final?(mod)
|
|
186
186
|
_check_final_ancestors(mod, mod.ancestors, [method_name])
|
|
187
|
+
# We need to fetch the active declaration again, as _check_final_ancestors
|
|
188
|
+
# may have reset it (see the comment in that method for details).
|
|
189
|
+
current_declaration = T::Private::DeclState.current.active_declaration
|
|
187
190
|
end
|
|
188
191
|
|
|
189
|
-
# We need to fetch the active declaration again, as _check_final_ancestors
|
|
190
|
-
# may have reset it (see the comment in that method for details).
|
|
191
|
-
current_declaration = T::Private::DeclState.current.active_declaration
|
|
192
192
|
if current_declaration.nil?
|
|
193
193
|
return
|
|
194
194
|
end
|
|
@@ -210,9 +210,9 @@ module T::Private::Methods
|
|
|
210
210
|
# which is called only on the *first* invocation.
|
|
211
211
|
# This wrapper is very slow, so it will subsequently re-wrap with a much faster wrapper
|
|
212
212
|
# (or unwrap back to the original method).
|
|
213
|
-
|
|
213
|
+
key = method_owner_and_name_to_key(mod, method_name)
|
|
214
214
|
T::Private::ClassUtils.replace_method(mod, method_name) do |*args, &blk|
|
|
215
|
-
method_sig = T::Private::Methods.
|
|
215
|
+
method_sig = T::Private::Methods.maybe_run_sig_block_for_key(key)
|
|
216
216
|
method_sig ||= T::Private::Methods._handle_missing_method_signature(
|
|
217
217
|
self,
|
|
218
218
|
original_method,
|
|
@@ -239,8 +239,6 @@ module T::Private::Methods
|
|
|
239
239
|
end
|
|
240
240
|
end
|
|
241
241
|
|
|
242
|
-
new_method = mod.instance_method(method_name)
|
|
243
|
-
key = method_to_key(new_method)
|
|
244
242
|
@sig_wrappers[key] = sig_block
|
|
245
243
|
if current_declaration.final
|
|
246
244
|
add_final_method(key)
|
|
@@ -379,7 +377,8 @@ module T::Private::Methods
|
|
|
379
377
|
maybe_run_sig_block_for_key(method_to_key(method))
|
|
380
378
|
end
|
|
381
379
|
|
|
382
|
-
|
|
380
|
+
# Only public so that it can be accessed in the closure for _on_method_added
|
|
381
|
+
def self.maybe_run_sig_block_for_key(key)
|
|
383
382
|
run_sig_block_for_key(key) if has_sig_block_for_key(key)
|
|
384
383
|
end
|
|
385
384
|
|
|
@@ -449,8 +449,11 @@ class T::Props::Decorator
|
|
|
449
449
|
|
|
450
450
|
@class.send(:define_method, redacted_method) do
|
|
451
451
|
value = self.public_send(prop_name)
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
handler = T::Configuration.redaction_handler
|
|
453
|
+
if !handler
|
|
454
|
+
raise "Using `redaction:` on a prop requires specifying `T::Configuration.redaction_handler`"
|
|
455
|
+
end
|
|
456
|
+
handler.call(value, redaction)
|
|
454
457
|
end
|
|
455
458
|
end
|
|
456
459
|
|
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.6349
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-03-
|
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|