sorbet-runtime 0.5.6173 → 0.5.6193

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9d4581ed43e607f92b1f5f6ad970c3c644c6f2e406f5389e52936f6664b4ba6
4
- data.tar.gz: 887f7dd88808b820f4e6ef28d11d2ba2302cb94ee0853551ee624db7442f73cd
3
+ metadata.gz: da1e18f5bf2d1bb67d0164d740345781f23379d2ab062b17b9f054d618d010c0
4
+ data.tar.gz: 838159e0d1248a14b2c183d5116c916bdfe118399117c52049b7fd8c13852194
5
5
  SHA512:
6
- metadata.gz: ca2e60518c4f7c03e56977394925e353090a555260f9c51fbca487c68ee43503ddc715ba12e319a7c58c2ca173d6222234d02785a89d36a02479385a2c775cb6
7
- data.tar.gz: ead7aa46dc4a488be9cbf8224aafa03fc15e7d569e5374bd6faaef1e97e1ca17b1bf28ef15deaa5f04bb1a0ad60331a6fded469744f4dace9c25ad22188360e3
6
+ metadata.gz: 18ba4e67b78a17be87fb4045d8916e751f08099ae08b6e0e1b974b18a12e368bf6362e19cab659183024e024e7f83eb51e58636cca22314664a7c59bb1f78cf6
7
+ data.tar.gz: deff3fbfa49139faddc11fb284f2380cacb8194146dd8a129fc553a4e9e23e8a88d7fdd5a3a62ee002faa061618a41697d33b720a23678ab7e7e084d92b23dbe
@@ -42,6 +42,34 @@ module T::Configuration
42
42
  T::Private::Methods.set_final_checks_on_hooks(false)
43
43
  end
44
44
 
45
+ @include_value_in_type_errors = true
46
+ # Whether to include values in TypeError messages.
47
+ #
48
+ # Including values is useful for debugging, but can potentially leak
49
+ # sensitive information to logs.
50
+ #
51
+ # @return [T::Boolean]
52
+ def self.include_value_in_type_errors?
53
+ @include_value_in_type_errors
54
+ end
55
+
56
+ # Configure if type errors excludes the value of the problematic type.
57
+ #
58
+ # The default is to include values in type errors:
59
+ # TypeError: Expected type Integer, got String with value "foo"
60
+ #
61
+ # When values are excluded from type errors:
62
+ # TypeError: Expected type Integer, got String
63
+ def self.exclude_value_in_type_errors
64
+ @include_value_in_type_errors = false
65
+ end
66
+
67
+ # Opposite of exclude_value_in_type_errors.
68
+ # (Including values in type errors is the default)
69
+ def self.include_value_in_type_errors
70
+ @include_value_in_type_errors = true
71
+ end
72
+
45
73
  # Configure the default checked level for a sig with no explicit `.checked`
46
74
  # builder. When unset, the default checked level is `:always`.
47
75
  #
@@ -119,8 +119,10 @@ module T::Types
119
119
  # Default inspect behavior of, eg; `#<Object:0x0...>` is ugly; just print the hash instead, which is more concise/readable.
120
120
  if obj.method(:inspect).owner == Kernel
121
121
  "type #{obj.class} with hash #{obj.hash}"
122
- else
122
+ elsif T::Configuration.include_value_in_type_errors?
123
123
  "type #{obj.class} with value #{T::Utils.string_truncate_middle(obj.inspect, 30, 30)}"
124
+ else
125
+ "type #{obj.class}"
124
126
  end
125
127
  rescue StandardError, SystemStackError
126
128
  "type #{obj.class} with unprintable value"
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.6173
4
+ version: 0.5.6193
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-19 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest