rbs_activesupport 1.3.0 → 1.4.0

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: cef80f9fcd93b640f1a7b9f942c4e779293abb6d330b3024217c06aa9705a51a
4
- data.tar.gz: f912a853966027885662ecefb6d676a8031986b6f045353b2d73fc2e7eaa7dec
3
+ metadata.gz: 9aff5090ae7c5a84c8472fe704bad2d643c7eec74367a71ade06e67fe548fbd4
4
+ data.tar.gz: 1c69a70033b144fe532c45cc313312406631a04503752f2a6deddf5a4960a3d2
5
5
  SHA512:
6
- metadata.gz: 22e1012db277a594d06677e7146cf026747928564c2cedbb3e6bc4a5d56ea293895a05259bdea5daa659b43dc11f1735afcc3e005a97f3c5279b189510e988d6
7
- data.tar.gz: 2cadf7e6b0d9d664a43b9f17fdbb0f223417d5094c7c53eefd44272e1a347be39db0167bec410101147a9d7311b61acf577c75e99a4768cd73299bf9e048fe45
6
+ metadata.gz: bbe64bfcf0498b6ea9500ccfbd4f250117bff44dabedd05fc5289ae3a3ecbb027b71c3d54e2fc6032ada3301a3d82887de1892886c7fd2ae856a953cc4fc0725
7
+ data.tar.gz: 6028e5ae17c835205bd7e32e3e59d050ce2cabe0439c0e040927075626f29b7dfb4b448301fd6502d5951e05aa4b13a48c3506a8e618b73f670011b9d346a985
@@ -15,17 +15,19 @@ module RbsActivesupport
15
15
 
16
16
  # @rbs namespace: RBS::Namespace
17
17
  # @rbs method_calls: Array[Parser::MethodCall]
18
- def build(namespace, method_calls) #: [Array[String], Array[String]]
19
- public_decls, private_decls = build_method_calls(namespace, method_calls).partition(&:public?)
20
- [public_decls.map(&method(:render)).compact, # steep:ignore BlockTypeMismatch
21
- private_decls.map(&method(:render)).compact] # steep:ignore BlockTypeMismatch
18
+ # @rbs context: RBS::Namespace?
19
+ def build(namespace, method_calls, context = nil) #: [Array[String], Array[String]]
20
+ built = build_method_calls(namespace, method_calls, context)
21
+ public_decls, private_decls = built.partition(&:public?)
22
+ [public_decls.map(&method(:render)), private_decls.map(&method(:render))] # steep:ignore BlockTypeMismatch
22
23
  end
23
24
 
24
25
  private
25
26
 
26
27
  # @rbs namespace: RBS::Namespace
27
28
  # @rbs method_calls: Array[Parser::MethodCall]
28
- def build_method_calls(namespace, method_calls) #: Array[t]
29
+ # @rbs context: RBS::Namespace?
30
+ def build_method_calls(namespace, method_calls, context) #: Array[t]
29
31
  method_calls.flat_map do |method_call|
30
32
  case method_call.name
31
33
  when :class_attribute
@@ -35,7 +37,7 @@ module RbsActivesupport
35
37
  when :cattr_accessor, :mattr_accessor, :cattr_reader, :mattr_reader, :cattr_writer, :mattr_writer
36
38
  build_attribute_accessor(method_call)
37
39
  when :include
38
- build_include(namespace, method_call)
40
+ build_include(namespace, method_call, context)
39
41
  end
40
42
  rescue StandardError => e
41
43
  puts "ERROR: #{namespace}:#{method_call.name}: Failed to build method calls: #{e}"
@@ -81,15 +83,19 @@ module RbsActivesupport
81
83
 
82
84
  # @rbs namespace: RBS::Namespace
83
85
  # @rbs method_call: Parser::MethodCall
84
- def build_include(namespace, method_call) #: Array[Include]
86
+ # @rbs context: RBS::Namespace?
87
+ def build_include(namespace, method_call, context) #: Array[t]
85
88
  module_paths = eval_include_args(method_call.args)
86
- module_paths.map do |module_path|
87
- Include.new(namespace, module_path, { private: method_call.private? })
89
+ module_paths.flat_map do |module_path|
90
+ include = Include.new(context || namespace, module_path, { private: method_call.private? })
91
+ ([include] +
92
+ build_method_calls(namespace, include.nested_includes, include.module_name) +
93
+ build_method_calls(namespace, include.method_calls_in_included_block, include.module_name))
88
94
  end
89
95
  end
90
96
 
91
97
  # @rbs decl: t
92
- def render(decl) #: String?
98
+ def render(decl) #: String
93
99
  case decl
94
100
  when AttributeAccessor
95
101
  render_attribute_accessor(decl)
@@ -103,36 +109,21 @@ module RbsActivesupport
103
109
  end
104
110
 
105
111
  # @rbs decl: AttributeAccessor
106
- def render_attribute_accessor(decl) #: String # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
112
+ def render_attribute_accessor(decl) #: String
107
113
  methods = []
108
- if decl.included?
109
- methods << "module ClassMethods"
110
- methods << " def #{decl.name}: () -> (#{decl.type})" if decl.singleton_reader?
111
- methods << " def #{decl.name}=: (#{decl.type}) -> (#{decl.type})" if decl.singleton_writer?
112
- methods << "end"
113
- else
114
- methods << "def self.#{decl.name}: () -> (#{decl.type})" if decl.singleton_reader?
115
- methods << "def self.#{decl.name}=: (#{decl.type}) -> (#{decl.type})" if decl.singleton_writer?
116
- end
114
+ methods << "def self.#{decl.name}: () -> (#{decl.type})" if decl.singleton_reader?
115
+ methods << "def self.#{decl.name}=: (#{decl.type}) -> (#{decl.type})" if decl.singleton_writer?
117
116
  methods << "def #{decl.name}: () -> (#{decl.type})" if decl.instance_reader?
118
117
  methods << "def #{decl.name}=: (#{decl.type}) -> (#{decl.type})" if decl.instance_writer?
119
118
  methods.join("\n")
120
119
  end
121
120
 
122
121
  # @rbs decl: ClassAttribute
123
- def render_class_attribute(decl) #: String # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
122
+ def render_class_attribute(decl) #: String
124
123
  methods = []
125
- if decl.included?
126
- methods << "module ClassMethods"
127
- methods << " def #{decl.name}: () -> (#{decl.type})"
128
- methods << " def #{decl.name}=: (#{decl.type}) -> (#{decl.type})"
129
- methods << " def #{decl.name}?: () -> bool" if decl.instance_predicate?
130
- methods << "end"
131
- else
132
- methods << "def self.#{decl.name}: () -> (#{decl.type})"
133
- methods << "def self.#{decl.name}=: (#{decl.type}) -> (#{decl.type})"
134
- methods << "def self.#{decl.name}?: () -> bool" if decl.instance_predicate?
135
- end
124
+ methods << "def self.#{decl.name}: () -> (#{decl.type})"
125
+ methods << "def self.#{decl.name}=: (#{decl.type}) -> (#{decl.type})"
126
+ methods << "def self.#{decl.name}?: () -> bool" if decl.instance_predicate?
136
127
  methods << "def #{decl.name}: () -> (#{decl.type})" if decl.instance_reader?
137
128
  methods << "def #{decl.name}=: (#{decl.type}) -> (#{decl.type})" if decl.instance_writer?
138
129
  methods << "def #{decl.name}?: () -> bool" if decl.instance_predicate? && decl.instance_reader?
@@ -147,13 +138,16 @@ module RbsActivesupport
147
138
  end
148
139
 
149
140
  # @rbs decl: Include
150
- def render_include(decl) #: String?
151
- return unless decl.concern? && decl.classmethods?
152
-
153
- <<~RBS
154
- include #{decl.module_path.to_s.delete_suffix("::")}
155
- extend #{decl.module_path}ClassMethods
156
- RBS
141
+ def render_include(decl) #: String
142
+ module_name = decl.module_name || decl.module_path
143
+ if decl.concern? && decl.classmethods?
144
+ <<~RBS
145
+ include #{module_name.to_s.delete_suffix("::")}
146
+ extend #{module_name}ClassMethods
147
+ RBS
148
+ else
149
+ "include #{module_name.to_s.delete_suffix("::")}"
150
+ end
157
151
  end
158
152
  end
159
153
  end
@@ -48,21 +48,23 @@ module RbsActivesupport
48
48
  def classmethods? #: boolish
49
49
  return false unless self.module
50
50
 
51
- self.module&.const_defined?(:ClassMethods) || will_generate_classmethods?
51
+ self.module&.const_defined?(:ClassMethods)
52
52
  end
53
53
 
54
- def will_generate_classmethods? #: bool
55
- return false unless module_name
54
+ def nested_includes #: Array[Parser::MethodCall]
55
+ return [] unless module_name
56
+ return [] unless parser
56
57
 
57
- path, = Object.const_source_location(module_name.to_s.delete_suffix("::")) #: String?
58
- return false unless path && File.exist?(path)
59
-
60
- parser = Parser.new
61
- parser.parse(File.read(path))
62
58
  method_calls = parser.method_calls[module_name] || []
63
- return true if method_calls.any?(&:included) # steep:ignore BlockTypeMismatch
59
+ method_calls.select { |call| call.name == :include && !call.included }
60
+ end
61
+
62
+ def method_calls_in_included_block #: Array[Parser::MethodCall]
63
+ return [] unless module_name
64
+ return [] unless parser
64
65
 
65
- false
66
+ method_calls = parser.method_calls[module_name] || []
67
+ method_calls.select(&:included)
66
68
  end
67
69
 
68
70
  def public? #: bool
@@ -72,5 +74,23 @@ module RbsActivesupport
72
74
  def private? #: bool
73
75
  options.fetch(:private, false)
74
76
  end
77
+
78
+ private
79
+
80
+ # @rbs @parser: Parser
81
+
82
+ # @rbs %a{pure}
83
+ def parser #: Parser?
84
+ return nil unless module_name
85
+
86
+ @parser ||= begin
87
+ path, = Object.const_source_location(module_name.to_s.delete_suffix("::")) #: String?
88
+ return nil unless path && File.exist?(path)
89
+
90
+ Parser.new(parse_included_block: true).tap do |parser|
91
+ parser.parse(File.read(path))
92
+ end
93
+ end
94
+ end
75
95
  end
76
96
  end
@@ -40,22 +40,21 @@ module RbsActivesupport
40
40
  METHODS = %i[
41
41
  class_attribute delegate cattr_accessor mattr_accessor cattr_reader mattr_reader cattr_writer mattr_writer include
42
42
  ].freeze #: Array[t] # steep:ignore IncompatibleAssignment
43
- INCLUDED_METHODS = %i[
44
- class_attribute cattr_accessor mattr_accessor cattr_reader mattr_reader cattr_writer mattr_writer
45
- ].freeze #: Array[Symbol]
46
43
 
47
44
  alias process_orig process
48
45
 
49
46
  attr_reader :comment_parser #: CommentParser
50
47
  attr_reader :method_calls #: Hash[RBS::Namespace, Array[MethodCall]]
48
+ attr_reader :parse_included_block #: bool
51
49
 
52
- # @rbs @included: bool
50
+ # @rbs @in_included_block: bool
53
51
 
54
- def initialize #: void
55
- super
52
+ def initialize(parse_included_block: false) #: void
53
+ super()
56
54
  @comment_parser = CommentParser.new
55
+ @parse_included_block = parse_included_block
57
56
  @method_calls = Hash.new { |hash, key| hash[key] = [] }
58
- @included = false
57
+ @in_included_block = false
59
58
  end
60
59
 
61
60
  # @rbs string: String
@@ -73,19 +72,17 @@ module RbsActivesupport
73
72
  args = node.children[1]&.children || []
74
73
  case node.children[0]
75
74
  when *METHODS
76
- return if included? && !INCLUDED_METHODS.include?(node.children[0])
77
-
78
75
  @method_calls[context.namespace] << MethodCall.new(node.children[0], args, private?(decls),
79
- included: included?,
76
+ included: in_included_block?,
80
77
  trailing_comment: trailing_comment_for(node))
81
78
  else
82
79
  process_orig(node, decls: decls, comments: comments, context: context)
83
80
  end
84
81
  when :ITER
85
82
  call = node.children[0]
86
- if call.type == :FCALL && call.children[0] == :included && !included?
83
+ if call.type == :FCALL && call.children[0] == :included && parse_included_block && !in_included_block?
87
84
  body = node.children[1].children[2]
88
- with_included do
85
+ with_included_block do
89
86
  process(body, decls: decls, comments: comments, context: context)
90
87
  end
91
88
  else
@@ -106,16 +103,16 @@ module RbsActivesupport
106
103
  current_accessibility(decls) == private
107
104
  end
108
105
 
109
- def included? #: bool
110
- @included
106
+ def in_included_block? #: bool
107
+ @in_included_block
111
108
  end
112
109
 
113
110
  # @rbs &block: () -> void
114
- def with_included(&block) #: void
115
- @included = true
111
+ def with_included_block(&block) #: void
112
+ @in_included_block = true
116
113
  block.call
117
114
  ensure
118
- @included = false
115
+ @in_included_block = false
119
116
  end
120
117
  end
121
118
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbsActivesupport
4
- VERSION = "1.3.0" #: String
4
+ VERSION = "1.4.0" #: String
5
5
  end
@@ -6,7 +6,7 @@ gems:
6
6
  source:
7
7
  type: git
8
8
  name: ruby/gem_rbs_collection
9
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
9
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
10
10
  remote: https://github.com/ruby/gem_rbs_collection.git
11
11
  repo_dir: gems
12
12
  - name: actionview
@@ -14,7 +14,7 @@ gems:
14
14
  source:
15
15
  type: git
16
16
  name: ruby/gem_rbs_collection
17
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
17
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
18
18
  remote: https://github.com/ruby/gem_rbs_collection.git
19
19
  repo_dir: gems
20
20
  - name: activesupport
@@ -22,7 +22,7 @@ gems:
22
22
  source:
23
23
  type: git
24
24
  name: ruby/gem_rbs_collection
25
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
25
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
26
26
  remote: https://github.com/ruby/gem_rbs_collection.git
27
27
  repo_dir: gems
28
28
  - name: ast
@@ -30,7 +30,7 @@ gems:
30
30
  source:
31
31
  type: git
32
32
  name: ruby/gem_rbs_collection
33
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
33
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
34
34
  remote: https://github.com/ruby/gem_rbs_collection.git
35
35
  repo_dir: gems
36
36
  - name: base64
@@ -50,7 +50,7 @@ gems:
50
50
  source:
51
51
  type: git
52
52
  name: ruby/gem_rbs_collection
53
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
53
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
54
54
  remote: https://github.com/ruby/gem_rbs_collection.git
55
55
  repo_dir: gems
56
56
  - name: connection_pool
@@ -58,7 +58,7 @@ gems:
58
58
  source:
59
59
  type: git
60
60
  name: ruby/gem_rbs_collection
61
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
61
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
62
62
  remote: https://github.com/ruby/gem_rbs_collection.git
63
63
  repo_dir: gems
64
64
  - name: date
@@ -82,7 +82,7 @@ gems:
82
82
  source:
83
83
  type: git
84
84
  name: ruby/gem_rbs_collection
85
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
85
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
86
86
  remote: https://github.com/ruby/gem_rbs_collection.git
87
87
  repo_dir: gems
88
88
  - name: io-console
@@ -114,7 +114,7 @@ gems:
114
114
  source:
115
115
  type: git
116
116
  name: ruby/gem_rbs_collection
117
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
117
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
118
118
  remote: https://github.com/ruby/gem_rbs_collection.git
119
119
  repo_dir: gems
120
120
  - name: optparse
@@ -126,7 +126,7 @@ gems:
126
126
  source:
127
127
  type: git
128
128
  name: ruby/gem_rbs_collection
129
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
129
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
130
130
  remote: https://github.com/ruby/gem_rbs_collection.git
131
131
  repo_dir: gems
132
132
  - name: parser
@@ -134,7 +134,7 @@ gems:
134
134
  source:
135
135
  type: git
136
136
  name: ruby/gem_rbs_collection
137
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
137
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
138
138
  remote: https://github.com/ruby/gem_rbs_collection.git
139
139
  repo_dir: gems
140
140
  - name: pathname
@@ -154,7 +154,7 @@ gems:
154
154
  source:
155
155
  type: git
156
156
  name: ruby/gem_rbs_collection
157
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
157
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
158
158
  remote: https://github.com/ruby/gem_rbs_collection.git
159
159
  repo_dir: gems
160
160
  - name: rails-dom-testing
@@ -162,7 +162,7 @@ gems:
162
162
  source:
163
163
  type: git
164
164
  name: ruby/gem_rbs_collection
165
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
165
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
166
166
  remote: https://github.com/ruby/gem_rbs_collection.git
167
167
  repo_dir: gems
168
168
  - name: railties
@@ -170,7 +170,7 @@ gems:
170
170
  source:
171
171
  type: git
172
172
  name: ruby/gem_rbs_collection
173
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
173
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
174
174
  remote: https://github.com/ruby/gem_rbs_collection.git
175
175
  repo_dir: gems
176
176
  - name: rainbow
@@ -178,7 +178,7 @@ gems:
178
178
  source:
179
179
  type: git
180
180
  name: ruby/gem_rbs_collection
181
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
181
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
182
182
  remote: https://github.com/ruby/gem_rbs_collection.git
183
183
  repo_dir: gems
184
184
  - name: rake
@@ -186,7 +186,7 @@ gems:
186
186
  source:
187
187
  type: git
188
188
  name: ruby/gem_rbs_collection
189
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
189
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
190
190
  remote: https://github.com/ruby/gem_rbs_collection.git
191
191
  repo_dir: gems
192
192
  - name: rbs
@@ -202,7 +202,7 @@ gems:
202
202
  source:
203
203
  type: git
204
204
  name: ruby/gem_rbs_collection
205
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
205
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
206
206
  remote: https://github.com/ruby/gem_rbs_collection.git
207
207
  repo_dir: gems
208
208
  - name: ripper
@@ -214,7 +214,7 @@ gems:
214
214
  source:
215
215
  type: git
216
216
  name: ruby/gem_rbs_collection
217
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
217
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
218
218
  remote: https://github.com/ruby/gem_rbs_collection.git
219
219
  repo_dir: gems
220
220
  - name: rubocop-ast
@@ -222,7 +222,7 @@ gems:
222
222
  source:
223
223
  type: git
224
224
  name: ruby/gem_rbs_collection
225
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
225
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
226
226
  remote: https://github.com/ruby/gem_rbs_collection.git
227
227
  repo_dir: gems
228
228
  - name: securerandom
@@ -246,7 +246,7 @@ gems:
246
246
  source:
247
247
  type: git
248
248
  name: ruby/gem_rbs_collection
249
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
249
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
250
250
  remote: https://github.com/ruby/gem_rbs_collection.git
251
251
  repo_dir: gems
252
252
  - name: time
@@ -266,7 +266,7 @@ gems:
266
266
  source:
267
267
  type: git
268
268
  name: ruby/gem_rbs_collection
269
- revision: 704f7e6b395fca717cc25c562598ca86015ed545
269
+ revision: dcc30eaed71a6e36acde3a018e6f1ffd27f72d09
270
270
  remote: https://github.com/ruby/gem_rbs_collection.git
271
271
  repo_dir: gems
272
272
  - name: uri
@@ -13,13 +13,15 @@ module RbsActivesupport
13
13
 
14
14
  # @rbs namespace: RBS::Namespace
15
15
  # @rbs method_calls: Array[Parser::MethodCall]
16
- def build: (RBS::Namespace namespace, Array[Parser::MethodCall] method_calls) -> [ Array[String], Array[String] ]
16
+ # @rbs context: RBS::Namespace?
17
+ def build: (RBS::Namespace namespace, Array[Parser::MethodCall] method_calls, ?RBS::Namespace? context) -> [ Array[String], Array[String] ]
17
18
 
18
19
  private
19
20
 
20
21
  # @rbs namespace: RBS::Namespace
21
22
  # @rbs method_calls: Array[Parser::MethodCall]
22
- def build_method_calls: (RBS::Namespace namespace, Array[Parser::MethodCall] method_calls) -> Array[t]
23
+ # @rbs context: RBS::Namespace?
24
+ def build_method_calls: (RBS::Namespace namespace, Array[Parser::MethodCall] method_calls, RBS::Namespace? context) -> Array[t]
23
25
 
24
26
  # @rbs method_call: Parser::MethodCall
25
27
  def build_attribute_accessor: (Parser::MethodCall method_call) -> Array[AttributeAccessor]
@@ -33,10 +35,11 @@ module RbsActivesupport
33
35
 
34
36
  # @rbs namespace: RBS::Namespace
35
37
  # @rbs method_call: Parser::MethodCall
36
- def build_include: (RBS::Namespace namespace, Parser::MethodCall method_call) -> Array[Include]
38
+ # @rbs context: RBS::Namespace?
39
+ def build_include: (RBS::Namespace namespace, Parser::MethodCall method_call, RBS::Namespace? context) -> Array[t]
37
40
 
38
41
  # @rbs decl: t
39
- def render: (t decl) -> String?
42
+ def render: (t decl) -> String
40
43
 
41
44
  # @rbs decl: AttributeAccessor
42
45
  def render_attribute_accessor: (AttributeAccessor decl) -> String
@@ -48,6 +51,6 @@ module RbsActivesupport
48
51
  def render_delegate: (Delegate decl) -> String
49
52
 
50
53
  # @rbs decl: Include
51
- def render_include: (Include decl) -> String?
54
+ def render_include: (Include decl) -> String
52
55
  end
53
56
  end
@@ -25,10 +25,20 @@ module RbsActivesupport
25
25
 
26
26
  def classmethods?: () -> boolish
27
27
 
28
- def will_generate_classmethods?: () -> bool
28
+ def nested_includes: () -> Array[Parser::MethodCall]
29
+
30
+ def method_calls_in_included_block: () -> Array[Parser::MethodCall]
29
31
 
30
32
  def public?: () -> bool
31
33
 
32
34
  def private?: () -> bool
35
+
36
+ private
37
+
38
+ @parser: Parser
39
+
40
+ # @rbs %a{pure}
41
+ %a{pure}
42
+ def parser: () -> Parser?
33
43
  end
34
44
  end
@@ -27,17 +27,17 @@ module RbsActivesupport
27
27
 
28
28
  METHODS: Array[t]
29
29
 
30
- INCLUDED_METHODS: Array[Symbol]
31
-
32
30
  alias process_orig process
33
31
 
34
32
  attr_reader comment_parser: CommentParser
35
33
 
36
34
  attr_reader method_calls: Hash[RBS::Namespace, Array[MethodCall]]
37
35
 
38
- @included: bool
36
+ attr_reader parse_included_block: bool
37
+
38
+ @in_included_block: bool
39
39
 
40
- def initialize: () -> void
40
+ def initialize: (?parse_included_block: untyped) -> void
41
41
 
42
42
  # @rbs string: String
43
43
  def parse: (String string) -> void
@@ -53,9 +53,9 @@ module RbsActivesupport
53
53
 
54
54
  private
55
55
 
56
- def included?: () -> bool
56
+ def in_included_block?: () -> bool
57
57
 
58
58
  # @rbs &block: () -> void
59
- def with_included: () { () -> void } -> void
59
+ def with_included_block: () { () -> void } -> void
60
60
  end
61
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs_activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi KOMIYA
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-14 00:00:00.000000000 Z
11
+ date: 2024-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description:
55
+ description:
56
56
  email:
57
57
  - i.tkomiya@gmail.com
58
58
  executables: []
@@ -106,7 +106,7 @@ metadata:
106
106
  homepage_uri: https://github.com/tk0miya/rbs_activesupport
107
107
  source_code_uri: https://github.com/tk0miya/rbs_activesupport
108
108
  changelog_uri: https://github.com/tk0miya/rbs_activesupport
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubygems_version: 3.5.16
125
- signing_key:
125
+ signing_key:
126
126
  specification_version: 4
127
127
  summary: A RBS files generatorfor activesupport
128
128
  test_files: []