sorbet-runtime 0.6.13274 → 0.6.13275

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d81d7a2d08ece67a7b4f4fa9af0e7c780211650fbf0730bb66e65a451e801fe
4
- data.tar.gz: 83c076b42350cc597ff6ad382c11f3b1f8ecdbdae636151b027a7a9687bc2541
3
+ metadata.gz: 717e7a8e84d644a5afb7d14417ccaed42da2a6ef811c9dd3035feeee101c11fd
4
+ data.tar.gz: 16f5fb77e086aa31acbf1d1b77f968ddd05511fdec586df1d24e26dfc61c1c2c
5
5
  SHA512:
6
- metadata.gz: 3ac4c6760207e22c1ab62a1154334811f02f2c9648a8ebf296f646d330180fae13eb610a5bc7d266c11c44af41926f513cb7a5c30284f23c8f573d055950504c
7
- data.tar.gz: 9b81697a3c3f6335ca3797ddd46b4109307f07d13ebff2930e6f9b54793ab994b59674d3671a3d5ac181ba3d4cefe5d4d5fd8a86728cddaf7814b05cabea3f31
6
+ metadata.gz: d16177658b783935acd782292692cc60f574fa472646eb0d88d78d90e4367352a48232969f7ce907d2e5b08fbbbe1077196c36dba6aa46da0854fd914f556fdd
7
+ data.tar.gz: f3fb7b569a24bc63aaebb77b0ec9c9b920a6b246fd3bdaf8c1b98a24895529e51305cc6a383acce813696d4b0032a0bec9e4e7762af9aa9d91ad755d8d369a42
@@ -51,6 +51,48 @@ if defined? ::RSpec::Mocks
51
51
  end
52
52
  end
53
53
 
54
+ # Allow using `sig {...}` on top of a `let`-defined method in an RSpec example group
55
+ if defined? ::RSpec::Core::MemoizedHelpers::ClassMethods
56
+ module T
57
+ module CompatibilityPatches
58
+ module RSpecCompatibility
59
+ module MemoizedHelpers
60
+ # `let!`, `subject`, and `subject!` are implemented by dispatching to
61
+ # `let`, so this should cover those methods too.
62
+ def let(name, &block)
63
+ # TODO(jez) This will need to use consume!
64
+
65
+ current_declaration = T::Private::DeclState.current.active_declaration
66
+ return super unless current_declaration
67
+ T::Private::DeclState.current.reset!
68
+
69
+ # Allow the `let`-defined methods to be defined
70
+ super
71
+
72
+ # Stash the sig and re-define the method RSpec just defined. This
73
+ # ensures that the `sig` attaches to the outer method, not any
74
+ # method inside the LetDefinitions module.
75
+ #
76
+ # Unfortunately, this means that the runtime checks are not
77
+ # memoized (but they never were).
78
+ #
79
+ # (An alternative approach of pretending that the `sig` was actually
80
+ # written inside the `LetDefinitions` module didn't work, because
81
+ # things like `sig {override}` broke: the `LetDefinitions` module
82
+ # has no ancestors and thus does not override anything)
83
+
84
+ method = instance_method(name)
85
+ remove_method(name)
86
+ T::Private::DeclState.current.active_declaration = current_declaration
87
+ define_method(name, method)
88
+ end
89
+ end
90
+ ::RSpec::Core::MemoizedHelpers::ClassMethods.prepend(MemoizedHelpers)
91
+ end
92
+ end
93
+ end
94
+ end
95
+
54
96
  # Work around for sorbet-runtime wrapped methods.
55
97
  #
56
98
  # When a sig is defined, sorbet-runtime will replace the sigged method
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet-runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.13274
4
+ version: 0.6.13275
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe