sorbet-runtime 0.5.6145 → 0.5.6173

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: 2ba7d406434902ec4853fc50ed2454313494c586ab1152960b45c4dcc79d21ff
4
- data.tar.gz: 532afa20a4d54c5d8ce828d656964d505bf5a57966e1401200bccd31cadc223d
3
+ metadata.gz: a9d4581ed43e607f92b1f5f6ad970c3c644c6f2e406f5389e52936f6664b4ba6
4
+ data.tar.gz: 887f7dd88808b820f4e6ef28d11d2ba2302cb94ee0853551ee624db7442f73cd
5
5
  SHA512:
6
- metadata.gz: 4d8841ddaf52d52d4d4e5bb45ecae4534cfe0571e007de01285364abfaf9c164f06f9d45395bfaa367cf727ea0ddb0e242d3ae5a57eefdb8b59c3c918127de2d
7
- data.tar.gz: 38c146f0027531a92f4e281074d7bebdc6445d0417727a3c21d77e36153c1f1cf4679bab853031ca97d1b3ad6fa9774d2142f51fc9b840a845df41fe16dd46c6
6
+ metadata.gz: ca2e60518c4f7c03e56977394925e353090a555260f9c51fbca487c68ee43503ddc715ba12e319a7c58c2ca173d6222234d02785a89d36a02479385a2c775cb6
7
+ data.tar.gz: ead7aa46dc4a488be9cbf8224aafa03fc15e7d569e5374bd6faaef1e97e1ca17b1bf28ef15deaa5f04bb1a0ad60331a6fded469744f4dace9c25ad22188360e3
@@ -363,6 +363,27 @@ module T::Configuration
363
363
  @scalar_types || @default_scalar_types
364
364
  end
365
365
 
366
+ # Guard against overrides of `name` or `to_s`
367
+ MODULE_NAME = Module.instance_method(:name)
368
+ private_constant :MODULE_NAME
369
+
370
+ @default_module_name_mangler = ->(type) {MODULE_NAME.bind(type).call}
371
+ @module_name_mangler = nil
372
+
373
+ def self.module_name_mangler
374
+ @module_name_mangler || @default_module_name_mangler
375
+ end
376
+
377
+ # Set to override the default behavior for converting types
378
+ # to names in generated code. Used by the runtime implementation
379
+ # associated with `--stripe-packages` mode.
380
+ #
381
+ # @param [Lambda, Proc, nil] value Proc that converts a type (Class/Module)
382
+ # to a String (pass nil to reset to default behavior)
383
+ def self.module_name_mangler=(handler)
384
+ @module_name_mangler = handler
385
+ end
386
+
366
387
  # Temporarily disable ruby warnings while executing the given block. This is
367
388
  # useful when doing something that would normally cause a warning to be
368
389
  # emitted in Ruby verbose mode ($VERBOSE = true).
@@ -357,4 +357,15 @@ class T::Enum
357
357
 
358
358
  raise "Inheriting from children of T::Enum is prohibited" if self != T::Enum
359
359
  end
360
+
361
+ # Marshal support
362
+ sig {params(_level: Integer).returns(String)}
363
+ def _dump(_level)
364
+ Marshal.dump(serialize)
365
+ end
366
+
367
+ sig {params(args: String).returns(T.attached_class)}
368
+ def self._load(args)
369
+ deserialize(Marshal.load(args))
370
+ end
360
371
  end
@@ -177,13 +177,9 @@ module T::Props
177
177
  end
178
178
  end
179
179
 
180
- # Guard against overrides of `name` or `to_s`
181
- MODULE_NAME = T.let(Module.instance_method(:name), UnboundMethod)
182
- private_constant :MODULE_NAME
183
-
184
180
  sig {params(type: Module).returns(T.nilable(String)).checked(:never)}
185
181
  private_class_method def self.module_name(type)
186
- MODULE_NAME.bind(type).call
182
+ T::Configuration.module_name_mangler.call(type)
187
183
  end
188
184
  end
189
185
  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.6145
4
+ version: 0.5.6173
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-11 00:00:00.000000000 Z
11
+ date: 2020-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest