yard2steep 0.1.1 → 0.1.2
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/Gemfile.lock +6 -1
- data/example/sample1/lib/example1.rb +20 -1
- data/example/sample1/sig/example1.rbi +3 -0
- data/lib/yard2steep/ast/p_node.rb +1 -0
- data/lib/yard2steep/gen.rb +2 -0
- data/lib/yard2steep/parser.rb +566 -373
- data/lib/yard2steep/type/parser.rb +6 -2
- data/lib/yard2steep/type.rb +9 -3
- data/lib/yard2steep/util.rb +9 -1
- data/lib/yard2steep/version.rb +1 -1
- data/sig/steep-scaffold/td.rbi +29 -42
- data/sig/yard2steep/yard2steep/parser.rbi +25 -36
- data/sig/yard2steep/yard2steep/type/parser.rbi +3 -3
- data/sig/yard2steep/yard2steep/type.rbi +2 -2
- data/yard2steep.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bb70f71599de19c3366d88dcafff7a50180c9358f2c331467158b3a711865cb
|
4
|
+
data.tar.gz: 7efcad232269e58c28f8cab663b10936eaa6c58fc5d8548426cfc8e768c21199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 934d8b340f06399d2990f96330c01eeece9db711a2dbfc7aebfb7e43355145b3dee1f4594081cdcd193f2211fe8200d9f2f4878346ab1879b9bb4dcffcf9783b
|
7
|
+
data.tar.gz: b674c6de151346cc48015d1b166c4c2059f1fd5967a4dbd94a1e14db05206876b78abea19921d236962cd272d37ac16e993533b6c8b1cac2253a6bd554fe2894
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yard2steep (0.1.
|
4
|
+
yard2steep (0.1.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -27,6 +27,9 @@ GEM
|
|
27
27
|
pry (0.11.3)
|
28
28
|
coderay (~> 1.1.0)
|
29
29
|
method_source (~> 0.9.0)
|
30
|
+
pry-doc (0.13.4)
|
31
|
+
pry (~> 0.11)
|
32
|
+
yard (~> 0.9.11)
|
30
33
|
rainbow (2.2.2)
|
31
34
|
rake
|
32
35
|
rake (10.5.0)
|
@@ -52,6 +55,7 @@ GEM
|
|
52
55
|
thread_safe (0.3.6)
|
53
56
|
tzinfo (1.2.5)
|
54
57
|
thread_safe (~> 0.1)
|
58
|
+
yard (0.9.14)
|
55
59
|
|
56
60
|
PLATFORMS
|
57
61
|
ruby
|
@@ -59,6 +63,7 @@ PLATFORMS
|
|
59
63
|
DEPENDENCIES
|
60
64
|
bundler (~> 1.16)
|
61
65
|
pry
|
66
|
+
pry-doc
|
62
67
|
rake (~> 10.0)
|
63
68
|
rspec (~> 3.2)
|
64
69
|
steep (= 0.4.0)
|
@@ -13,8 +13,12 @@ end
|
|
13
13
|
# @param [Array] contents
|
14
14
|
|
15
15
|
class SomeClass
|
16
|
-
# @dynamic index
|
16
|
+
# @dynamic index, comment
|
17
17
|
attr_reader :index
|
18
|
+
attr_reader("comment")
|
19
|
+
end
|
20
|
+
|
21
|
+
module SomeModule
|
18
22
|
end
|
19
23
|
|
20
24
|
class MyClass
|
@@ -60,6 +64,14 @@ class MyClass
|
|
60
64
|
{}
|
61
65
|
end
|
62
66
|
|
67
|
+
# @param [String] base
|
68
|
+
# @param [Integer] off
|
69
|
+
# @param [Hash] opt
|
70
|
+
# @return [String]
|
71
|
+
def comment(base, off = 0, opt: {})
|
72
|
+
""
|
73
|
+
end
|
74
|
+
|
63
75
|
# @param [Integer] off
|
64
76
|
# @return [Hash{ Symbol => Integer, nil }]
|
65
77
|
def values(off: 0)
|
@@ -97,6 +109,13 @@ class MyClass
|
|
97
109
|
list.last
|
98
110
|
end
|
99
111
|
|
112
|
+
# NOTE: Args after default args is not supported by steep.
|
113
|
+
# # @param [String] str
|
114
|
+
# # @param [Integer] id
|
115
|
+
# # @param [Array] rest
|
116
|
+
# def setup(str, id = 1, rest)
|
117
|
+
# end
|
118
|
+
|
100
119
|
# NOTE: should be interpreterd as any -> any
|
101
120
|
def present?(list)
|
102
121
|
list.size > 0
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class SomeClass
|
2
2
|
@index: any
|
3
|
+
@comment: any
|
3
4
|
def index: -> any
|
5
|
+
def comment: -> any
|
4
6
|
end
|
5
7
|
class MyClass
|
6
8
|
def self.name: -> String
|
@@ -9,6 +11,7 @@ class MyClass
|
|
9
11
|
def nest: -> Array<Array<Symbol>>
|
10
12
|
def type: -> Array<Symbol | Integer>
|
11
13
|
def opts: -> Hash<any, any>
|
14
|
+
def comment: (String, ?Integer, ?opt: Hash<any, any>) -> String
|
12
15
|
def values: (?off: Integer) -> Hash<Symbol, Integer | nil>
|
13
16
|
def nest_hash: -> Hash<Symbol, Array<Integer>>
|
14
17
|
def reverse: (Array<Integer>, order: Symbol) -> Array<Integer>
|
data/lib/yard2steep/gen.rb
CHANGED
@@ -150,6 +150,8 @@ module Yard2steep
|
|
150
150
|
case p_node.style
|
151
151
|
when AST::PNode::STYLE[:normal]
|
152
152
|
emit! t.p_type
|
153
|
+
when AST::PNode::STYLE[:normal_with_default]
|
154
|
+
emit! "?#{t.p_type}"
|
153
155
|
when AST::PNode::STYLE[:keyword]
|
154
156
|
emit! "#{t.p_name}: #{t.p_type}"
|
155
157
|
when AST::PNode::STYLE[:keyword_with_default]
|