sorbet-runtime 0.5.6164 → 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: b51530878b628ed08eb5365e8f2c29cc0513824663bbc8747731ff565095b7c3
4
- data.tar.gz: 97959717978d9074b8104b4b86c25b63db32c6f8eff6b86d6eb397a92ca32f30
3
+ metadata.gz: a9d4581ed43e607f92b1f5f6ad970c3c644c6f2e406f5389e52936f6664b4ba6
4
+ data.tar.gz: 887f7dd88808b820f4e6ef28d11d2ba2302cb94ee0853551ee624db7442f73cd
5
5
  SHA512:
6
- metadata.gz: 73854249dc4f1ae52dcec6eebe03817771f40434f4a80c5b2bd0a457ce60d500931b5afb3845be1d810687208ba28ed431a1185df547c1279526642e13cd850f
7
- data.tar.gz: 6ad1f94ecaa3888569a827f9d4f82ce8d7a43887dcfb754465c45cd022cc045c12b21f03ce32103b5b894ed1964b33a8545e8ed6e4755aef3f6a1281383ecf7d
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).
@@ -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.6164
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-18 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