yard-sorbet 0.5.3 → 0.6.0

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: ee5168e45f37fe7d16db534727b57fad2a08e05acda8298ef421589aa72f0354
4
- data.tar.gz: ce10ba6df63c35ba4b52eb4f7d8b02878cfb01fea7424e966aad739691d1d767
3
+ metadata.gz: 809250a1720fa07f83c0a4545ef5addf33f5a2d4be0dc21e2ca69bd63730bd66
4
+ data.tar.gz: 7f8381d22e69b630627cc3a833ddde59938522800ea7d2966bd98ae39fe33a35
5
5
  SHA512:
6
- metadata.gz: faa0b506388d501f6567ddfd08144185b1e761a1d4d4cfec12e3256f3985f626ddbc2da1423b37896fbe132a1e729a3c44b995b957eb0391aa48ded9519978d4
7
- data.tar.gz: 2afbc9875afecab271abccfd12b5023c3e7db429f23f689fdbed18ed2e0fd7f3b51137ee86b649bb501ea921c469774e2096887d1d063599ae72939951b2f719
6
+ metadata.gz: bf72fdb12fb92b88414edd595484734175d2d8f2a6be4030414e8871d858de62c077c862f64aa738911b9ea2d90a2ae616e986c128e35ceb5a0de6ed052a0576
7
+ data.tar.gz: 5f04cb364f05793cd5112ebfcd2681291aedad3e851c1f9ba8e5302750fd16446d61e3e9862a1634f8d472a7ad3fb2325fcffde8789e6df9a34d4484c055fba2
@@ -0,0 +1,37 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module YARDSorbet
5
+ module Handlers
6
+ # Extends any modules included via `mixes_in_class_methods`
7
+ # @see https://sorbet.org/docs/abstract#interfaces-and-the-included-hook
8
+ # Sorbet `mixes_in_class_methods` documentation
9
+ class IncludeHandler < YARD::Handlers::Ruby::Base
10
+ extend T::Sig
11
+
12
+ handles method_call(:include)
13
+ namespace_only
14
+
15
+ sig { void }
16
+ def process
17
+ return unless extra_state.mix_in_class_methods
18
+
19
+ statement.parameters(false).each do |mixin|
20
+ obj = YARD::CodeObjects::Proxy.new(namespace, mixin.source)
21
+ class_methods_namespace = extra_state.mix_in_class_methods[obj.to_s]
22
+ next unless class_methods_namespace
23
+
24
+ included_in.mixins(:class) << YARD::CodeObjects::Proxy.new(obj, class_methods_namespace)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ # @return the namespace object that is including the module
31
+ sig { returns(YARD::CodeObjects::NamespaceObject) }
32
+ def included_in
33
+ statement.namespace ? YARD::CodeObjects::Proxy.new(namespace, statement.namespace.source) : namespace
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,22 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module YARDSorbet
5
+ module Handlers
6
+ # Tracks modules that invoke `mixes_in_class_methods` for use in {IncludeHandler}
7
+ # @see https://sorbet.org/docs/abstract#interfaces-and-the-included-hook
8
+ # Sorbet `mixes_in_class_methods` documentation
9
+ class MixesInClassMethodsHandler < YARD::Handlers::Ruby::Base
10
+ extend T::Sig
11
+
12
+ handles method_call(:mixes_in_class_methods)
13
+ namespace_only
14
+
15
+ sig { void }
16
+ def process
17
+ extra_state.mix_in_class_methods ||= {}
18
+ extra_state.mix_in_class_methods[namespace.to_s] = statement.parameters(false)[0].source
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  # typed: strict
2
2
  # This is in an rbi so the runtime doesn't depend on experimental sorbet features
3
3
  module YARDSorbet::Handlers::StructClassHandler
4
- requires_ancestor YARD::Handlers::Ruby::ClassHandler
4
+ requires_ancestor { YARD::Handlers::Ruby::ClassHandler }
5
5
  end
@@ -9,6 +9,8 @@ end
9
9
 
10
10
  require_relative 'handlers/abstract_dsl_handler'
11
11
  require_relative 'handlers/enums_handler'
12
+ require_relative 'handlers/include_handler'
13
+ require_relative 'handlers/mixes_in_class_methods_handler'
12
14
  require_relative 'handlers/sig_handler'
13
15
  require_relative 'handlers/struct_class_handler'
14
16
  require_relative 'handlers/struct_prop_handler'
@@ -4,5 +4,5 @@
4
4
  # Types are documentation
5
5
  module YARDSorbet
6
6
  # {https://rubygems.org/gems/yard-sorbet Version history}
7
- VERSION = '0.5.3'
7
+ VERSION = '0.6.0'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Eichelberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-01 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.18.0
89
+ version: 1.22.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.18.0
96
+ version: 1.22.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop-performance
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.4.0
131
+ version: 2.5.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 2.4.0
138
+ version: 2.5.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-sorbet
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.5.6289
173
+ version: 0.5.9204
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.5.6289
180
+ version: 0.5.9204
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: sorbet-runtime
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +220,8 @@ files:
220
220
  - lib/yard-sorbet/handlers.rb
221
221
  - lib/yard-sorbet/handlers/abstract_dsl_handler.rb
222
222
  - lib/yard-sorbet/handlers/enums_handler.rb
223
+ - lib/yard-sorbet/handlers/include_handler.rb
224
+ - lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb
223
225
  - lib/yard-sorbet/handlers/sig_handler.rb
224
226
  - lib/yard-sorbet/handlers/struct_class_handler.rb
225
227
  - lib/yard-sorbet/handlers/struct_class_handler.rbi