sorbet-runtime 0.5.6239 → 0.5.6249
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/configuration.rb +26 -0
- data/lib/types/props/decorator.rb +3 -2
- data/lib/types/props/serializable.rb +2 -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: 836a1fbf0f8401ea225ae5124205ba0cdcfccab4164ab3b1e342bf285d7ea19b
|
4
|
+
data.tar.gz: 8758dcc34d96534830fc097a269d45c307f6841a9f20643c633be33eca142816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54ad13d894a1a35e28735d4e20f785e8cee486c8acf2786587639c1084ad2a881c36e0e3b8799553fb9fcc73bb7354fb085cd59402a83ff4259c7a0ef34fc935
|
7
|
+
data.tar.gz: 854336ccb394ab1524e171a29f130227dfc1cc8d8cf72b1ce6453c4c2a773d9e1ecd02393b0084eca6e6cdd1e9b5c5d999305c48bee051902b917ab754b07988
|
data/lib/types/configuration.rb
CHANGED
@@ -412,6 +412,32 @@ module T::Configuration
|
|
412
412
|
@module_name_mangler = handler
|
413
413
|
end
|
414
414
|
|
415
|
+
# Set to a PII handler function. This will be called with the `sensitivity:`
|
416
|
+
# annotations on things that use `T::Props` and can modify them ahead-of-time.
|
417
|
+
#
|
418
|
+
# @param [Lambda, Proc, nil] value Proc that takes a hash mapping symbols to the
|
419
|
+
# prop values. Pass nil to avoid changing `sensitivity:` annotations.
|
420
|
+
def self.normalize_sensitivity_and_pii_handler=(handler)
|
421
|
+
@sensitivity_and_pii_handler = handler
|
422
|
+
end
|
423
|
+
|
424
|
+
def self.normalize_sensitivity_and_pii_handler
|
425
|
+
@sensitivity_and_pii_handler
|
426
|
+
end
|
427
|
+
|
428
|
+
# Set to a function which can get the 'owner' of a class. This is
|
429
|
+
# used in reporting deserialization errors
|
430
|
+
#
|
431
|
+
# @param [Lambda, Proc, nil] value Proc that takes a class and
|
432
|
+
# produces its owner, or `nil` if it does not have one.
|
433
|
+
def self.class_owner_finder=(handler)
|
434
|
+
@class_owner_finder = handler
|
435
|
+
end
|
436
|
+
|
437
|
+
def self.class_owner_finder
|
438
|
+
@class_owner_finder
|
439
|
+
end
|
440
|
+
|
415
441
|
# Temporarily disable ruby warnings while executing the given block. This is
|
416
442
|
# useful when doing something that would normally cause a warning to be
|
417
443
|
# emitted in Ruby verbose mode ($VERBOSE = true).
|
@@ -306,8 +306,9 @@ class T::Props::Decorator
|
|
306
306
|
type = T::Utils::Nilable.get_underlying_type(type)
|
307
307
|
|
308
308
|
sensitivity_and_pii = {sensitivity: rules[:sensitivity]}
|
309
|
-
|
310
|
-
|
309
|
+
normalize = T::Configuration.normalize_sensitivity_and_pii_handler
|
310
|
+
if normalize
|
311
|
+
sensitivity_and_pii = normalize.call(sensitivity_and_pii)
|
311
312
|
|
312
313
|
# We check for Class so this is only applied on concrete
|
313
314
|
# documents/models; We allow mixins containing props to not
|
@@ -246,11 +246,11 @@ module T::Props::Serializable::DecoratorMethods
|
|
246
246
|
|
247
247
|
# Notify the model owner if it exists, and always notify the API owner.
|
248
248
|
begin
|
249
|
-
if
|
249
|
+
if T::Configuration.class_owner_finder && (owner = T::Configuration.class_owner_finder.call(decorated_class))
|
250
250
|
T::Configuration.hard_assert_handler(
|
251
251
|
msg,
|
252
252
|
storytime: storytime,
|
253
|
-
project:
|
253
|
+
project: owner
|
254
254
|
)
|
255
255
|
end
|
256
256
|
ensure
|
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.6249
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|