yard-rustdoc 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yard-rustdoc/handlers.rb +1 -1
- data/lib/yard-rustdoc/statements.rb +13 -2
- data/lib/yard-rustdoc/version.rb +1 -1
- data/lib/yard-rustdoc.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4967b9c11e8b1ae8ee17256f03033e05312d501c80c0d7b064b406be63b5855d
|
4
|
+
data.tar.gz: 43b2bd77f9fc7c99ec64ae6d499c55fbf9882cbe65a9d550b08cf03ea2c7bf55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0433a034cdf09fe3187b4d206bc857353ee79e56177908157c9c894b5149dc9433f1676ab06dbd7b524fb7a803c4ec5e4072a9f4846e7c995600382f29253fc8
|
7
|
+
data.tar.gz: 258f273a75c1ed52c12a8718641e6ae459acf0d45edba16826d7903d39072e55f4b23bf6fa27fd9f6920a19c9728a1d4f7383c013e7571b45a95d3ff59ac42b6
|
@@ -34,7 +34,7 @@ module YARD::Handlers
|
|
34
34
|
statement_class(Statements::Struct)
|
35
35
|
|
36
36
|
process do
|
37
|
-
obj =
|
37
|
+
obj = statement.code_object_class.new(:root, statement.name)
|
38
38
|
register(obj)
|
39
39
|
|
40
40
|
push_state(namespace: obj) do
|
@@ -10,8 +10,7 @@ module YARD::Parser::Rustdoc
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def docstring
|
13
|
-
@docstring ||=
|
14
|
-
.fetch("docs")
|
13
|
+
@docstring ||= rust_docstring
|
15
14
|
.gsub(/^\s*@yard\s*\n/m, "") # remove @yard line
|
16
15
|
end
|
17
16
|
|
@@ -56,6 +55,10 @@ module YARD::Parser::Rustdoc
|
|
56
55
|
def line_index_range
|
57
56
|
(@rustdoc.dig("span", "begin", 0) - 1)..@rustdoc.dig("span", "end", 0)
|
58
57
|
end
|
58
|
+
|
59
|
+
def rust_docstring
|
60
|
+
@rustdoc.fetch("docs")
|
61
|
+
end
|
59
62
|
end
|
60
63
|
|
61
64
|
class Struct < Base
|
@@ -81,6 +84,14 @@ module YARD::Parser::Rustdoc
|
|
81
84
|
# Fallback to the struct's name
|
82
85
|
@rustdoc.fetch("name")
|
83
86
|
end
|
87
|
+
|
88
|
+
def code_object_class
|
89
|
+
if rust_docstring.match?(/^@module\b/)
|
90
|
+
YARD::CodeObjects::ModuleObject
|
91
|
+
else
|
92
|
+
YARD::CodeObjects::ClassObject
|
93
|
+
end
|
94
|
+
end
|
84
95
|
end
|
85
96
|
|
86
97
|
class Method < Base
|
data/lib/yard-rustdoc/version.rb
CHANGED
data/lib/yard-rustdoc.rb
CHANGED
@@ -15,4 +15,5 @@ module YARD
|
|
15
15
|
Tags::Library.define_tag("Tagging docblock for yard", :yard)
|
16
16
|
Tags::Library.define_tag("Renaming class & methods", :rename)
|
17
17
|
Tags::Library.define_tag("Specify a method name and args", :def)
|
18
|
+
Tags::Library.define_tag("Specify that a Struct should be a module (instead of class)", :module)
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-rustdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Bourassa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|