sorbet-runtime 0.5.5247 → 0.5.5255
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 +27 -0
- data/lib/types/private/sealed.rb +5 -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: 5001cde809170dd114c21f38d060d0ea4d0c7447bd719020a28d8219c733593b
|
4
|
+
data.tar.gz: 8af071522bf9cfcfd89eea4ca0567e06ad6109cfe2e827f00542a00e971eaa26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7695bfaf0c47b193d1cccc99cb89159a7d29e2efbfb89c21c3dbbcd9c1ba4c5cb53ba12dbceb9589b2d51b6bc765854d45469931740a3c73f2c40517defa4c0
|
7
|
+
data.tar.gz: 812f4170808544d2d320fb834f28fcbdeba7d9ba26041b18cdece81aaae8feb1d924d7e942a60b4d305b5747867cd75abd6149da2be9ffc30ef966c3c89bb9f8
|
data/lib/types/configuration.rb
CHANGED
@@ -393,6 +393,33 @@ module T::Configuration
|
|
393
393
|
@legacy_t_enum_migration_mode || false
|
394
394
|
end
|
395
395
|
|
396
|
+
# @param [Array] sealed_violation_whitelist An array of Regexp to validate
|
397
|
+
# whether inheriting /including a sealed module outside the defining module
|
398
|
+
# should be allowed. Useful to whitelist benign violations, like shim files
|
399
|
+
# generated for an autoloader.
|
400
|
+
def self.sealed_violation_whitelist=(sealed_violation_whitelist)
|
401
|
+
if @sealed_violation_whitelist != nil
|
402
|
+
raise ArgumentError.new("Cannot overwrite sealed_violation_whitelist after setting it")
|
403
|
+
end
|
404
|
+
|
405
|
+
case sealed_violation_whitelist
|
406
|
+
when Array
|
407
|
+
sealed_violation_whitelist.each do |x|
|
408
|
+
case x
|
409
|
+
when Regexp then nil
|
410
|
+
else raise TypeError.new("sealed_violation_whitelist accepts an Array of Regexp")
|
411
|
+
end
|
412
|
+
end
|
413
|
+
else
|
414
|
+
raise TypeError.new("sealed_violation_whitelist= accepts an Array of Regexp")
|
415
|
+
end
|
416
|
+
|
417
|
+
@sealed_violation_whitelist = sealed_violation_whitelist
|
418
|
+
end
|
419
|
+
def self.sealed_violation_whitelist
|
420
|
+
@sealed_violation_whitelist
|
421
|
+
end
|
422
|
+
|
396
423
|
private_class_method def self.validate_lambda_given!(value)
|
397
424
|
if !value.nil? && !value.respond_to?(:call)
|
398
425
|
raise ArgumentError.new("Provided value must respond to :call")
|
data/lib/types/private/sealed.rb
CHANGED
@@ -54,6 +54,11 @@ module T::Private::Sealed
|
|
54
54
|
end
|
55
55
|
|
56
56
|
if !this_file.start_with?(decl_file)
|
57
|
+
whitelist = T::Configuration.sealed_violation_whitelist
|
58
|
+
if whitelist != nil && whitelist.any? {|pattern| decl_file =~ pattern}
|
59
|
+
return
|
60
|
+
end
|
61
|
+
|
57
62
|
raise "#{parent} was declared sealed and can only be #{verb} in #{decl_file}, not #{this_file}"
|
58
63
|
end
|
59
64
|
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.5255
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|