yard-sig 0.2.2 → 0.2.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -0
- data/lib/yard-sig/sig.rb +14 -12
- data/lib/yard-sig/version.rb +1 -1
- 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: 7ab2bf52e54c80a38edafd9ddbd34e0c1238e26001b582e828cecbd44b7fde2a
|
|
4
|
+
data.tar.gz: 88be629986e49ae4d1d4fcb2a1555f2dcce9828664a9fbdc860ae4433d8240e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f363d438620ae79fd852525a0ff3e8f3bd30adff94799d3a4e3a6aaae6e7e335d1a4357d212b1a5eae11021ab7953edf8b7c795356826300cedf2a81b0e7160
|
|
7
|
+
data.tar.gz: ccd484cc3b40d4335747946b799eb9d2796a75304a4435fa8128d1ee0b9d29505d2411cc1e91dce954a33b44895a20119e892d508c630dfa0279543f5845e2f6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
[](https://badge.fury.io/rb/yard-sig)
|
|
2
|
+
[](https://github.com/sinsoku/yard-sig/actions/workflows/test.yml)
|
|
3
|
+
|
|
1
4
|
# yard-sig
|
|
2
5
|
|
|
3
6
|
A YARD plugin for writing documentations with [RBS syntax](https://github.com/ruby/rbs).
|
data/lib/yard-sig/sig.rb
CHANGED
|
@@ -52,9 +52,9 @@ module YardSig
|
|
|
52
52
|
name = type.name ? type.name.to_s : find_name_from_yard(kind, pos)
|
|
53
53
|
|
|
54
54
|
if kind == :rest
|
|
55
|
-
yard_types = "Array<#{yard_types}>"
|
|
55
|
+
yard_types = "Array<#{yard_types.join(", ")}>"
|
|
56
56
|
elsif kind == :keyrest
|
|
57
|
-
yard_types = "Hash{Symbol => #{yard_types}}"
|
|
57
|
+
yard_types = "Hash{Symbol => #{yard_types.join(", ")}}"
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
YARD::Tags::Tag.new(tag_name, "", yard_types, name)
|
|
@@ -82,29 +82,31 @@ module YardSig
|
|
|
82
82
|
when RBS::Types::Bases::Void, RBS::Types::Bases::Any, RBS::Types::Bases::Bottom
|
|
83
83
|
nil
|
|
84
84
|
when RBS::Types::Bases::Top
|
|
85
|
-
"Object"
|
|
85
|
+
["Object"]
|
|
86
86
|
when RBS::Types::Union
|
|
87
|
-
type.types.map { |t| to_yard_type(t) }
|
|
87
|
+
type.types.map { |t| to_yard_type(t) }
|
|
88
88
|
when RBS::Types::Tuple
|
|
89
89
|
args = type.types.map { |t| to_yard_type(t) }.join(", ")
|
|
90
|
-
"Array[#{args}]"
|
|
90
|
+
["Array[#{args}]"]
|
|
91
91
|
when RBS::Types::Bases::Bool
|
|
92
|
-
"Boolean"
|
|
92
|
+
["Boolean"]
|
|
93
93
|
when RBS::Types::Bases::Instance
|
|
94
|
-
@namespace.to_s
|
|
94
|
+
[@namespace.to_s]
|
|
95
95
|
when RBS::Types::Optional
|
|
96
|
-
|
|
96
|
+
[to_yard_type(type.type).join(", ").to_s, "nil"]
|
|
97
97
|
when RBS::Types::ClassInstance
|
|
98
98
|
args = type.args.map { |t| to_yard_type(t) }
|
|
99
99
|
if args.empty?
|
|
100
|
-
type.to_s
|
|
100
|
+
[type.to_s]
|
|
101
101
|
elsif type.name.name == :Hash
|
|
102
|
-
|
|
102
|
+
key = args[0].join(", ")
|
|
103
|
+
value = args[1].join(", ")
|
|
104
|
+
["#{type.name}{#{key} => #{value}}"]
|
|
103
105
|
else
|
|
104
|
-
"#{type.name}<#{args.join(", ")}>"
|
|
106
|
+
["#{type.name}<#{args.join(", ")}>"]
|
|
105
107
|
end
|
|
106
108
|
else
|
|
107
|
-
type.to_s
|
|
109
|
+
[type.to_s]
|
|
108
110
|
end
|
|
109
111
|
end
|
|
110
112
|
|
data/lib/yard-sig/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yard-sig
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takumi Shotoku
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rbs
|
|
@@ -63,8 +63,8 @@ licenses:
|
|
|
63
63
|
- MIT
|
|
64
64
|
metadata:
|
|
65
65
|
homepage_uri: https://github.com/sinsoku/yard-sig
|
|
66
|
-
source_code_uri: https://github.com/sinsoku/yard-sig/blob/v0.2.
|
|
67
|
-
changelog_uri: https://github.com/sinsoku/yard-sig/tree/v0.2.
|
|
66
|
+
source_code_uri: https://github.com/sinsoku/yard-sig/blob/v0.2.3/CHANGELOG.md
|
|
67
|
+
changelog_uri: https://github.com/sinsoku/yard-sig/tree/v0.2.3
|
|
68
68
|
post_install_message:
|
|
69
69
|
rdoc_options: []
|
|
70
70
|
require_paths:
|