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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dd410ad306476662e4768508ddb91363d6881d8714b83588f890b871571e8c2
4
- data.tar.gz: a4ea944e7ec8b0ddaec01dfadce13cf85ad934ee1612aeff4ca00b045396f57e
3
+ metadata.gz: 9bb70f71599de19c3366d88dcafff7a50180c9358f2c331467158b3a711865cb
4
+ data.tar.gz: 7efcad232269e58c28f8cab663b10936eaa6c58fc5d8548426cfc8e768c21199
5
5
  SHA512:
6
- metadata.gz: ca073d5d4eba5d8caad1d94877b9d7800cd1ec10306f2f02e8bc36cd37695e70a5e571c30aafeec27f0e42842e25ac34e46d1115f0534a39c846085612d97e1e
7
- data.tar.gz: 470f49608f90134ce4cddee5e9a905371347ae3ad8eb49b245a2d8fab83b8be8b5d9d82fb813cf2389c49fdfecbb6c23f9f32b9ac2973bcd46010ba0a410ec7e
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.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>
@@ -6,6 +6,7 @@ module Yard2steep
6
6
 
7
7
  STYLE = {
8
8
  normal: "STYLE.normal",
9
+ normal_with_default: "STYLE.normal_with_default",
9
10
  keyword: "STYLE.keyword",
10
11
  keyword_with_default: "STYLE.keyword_with_default",
11
12
  }
@@ -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]