rbs_activesupport 1.3.0 → 1.4.1
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/README.md +15 -8
- data/lib/rbs_activesupport/declaration_builder.rb +33 -39
- data/lib/rbs_activesupport/generator.rb +2 -0
- data/lib/rbs_activesupport/include.rb +30 -10
- data/lib/rbs_activesupport/parser.rb +14 -17
- data/lib/rbs_activesupport/version.rb +1 -1
- data/rbs_collection.lock.yaml +40 -20
- data/sig/rbs_activesupport/declaration_builder.rbs +8 -5
- data/sig/rbs_activesupport/include.rbs +11 -1
- data/sig/rbs_activesupport/parser.rbs +6 -6
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae53360ab164472d4e7ec85deda07504d139bfb1ae654bdaac8589f0f9d191a
|
4
|
+
data.tar.gz: 32da6fa5ac99c059b2625c82b72c6e354e1980a549bff337094cd8bc15ac0e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a5f3ede5ab15f4524766710314749425225fad5ab8f6f88c1394ebd82f8df858814b6dd401ca768d7b1183db46ae9e9d3eaa2242c79b5a670152e339c5f1b6
|
7
|
+
data.tar.gz: 53d1b808b66ae6e3c5ae421e61267bfc2d2ce86e3c7ad02be163c94a70d4611af0c148ed6a825460dd4f4c7bb2923bcb12871cd3fa087377dd1facd5a123a7a8
|
data/README.md
CHANGED
@@ -98,23 +98,30 @@ module MyConcern
|
|
98
98
|
extend ActiveSupport::Concern
|
99
99
|
|
100
100
|
included do
|
101
|
-
class_attribute :name
|
101
|
+
class_attribute :name #: String
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
class User
|
106
|
+
include MyConcern
|
107
|
+
end
|
104
108
|
```
|
105
109
|
|
106
110
|
It is translated to the following RBS:
|
107
111
|
|
108
112
|
```ruby
|
109
113
|
module MyConcern
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
114
|
+
extend ActiveSupport::Concern
|
115
|
+
end
|
116
|
+
|
117
|
+
class User
|
118
|
+
include MyConcern
|
115
119
|
|
116
|
-
def name: () ->
|
117
|
-
def name=: (
|
120
|
+
def self.name: () -> String
|
121
|
+
def self.name=: (String) -> String
|
122
|
+
def self.name?: () -> bool
|
123
|
+
def name: () -> String
|
124
|
+
def name=: (String) -> String
|
118
125
|
def name?: () -> bool
|
119
126
|
end
|
120
127
|
```
|
@@ -15,17 +15,19 @@ module RbsActivesupport
|
|
15
15
|
|
16
16
|
# @rbs namespace: RBS::Namespace
|
17
17
|
# @rbs method_calls: Array[Parser::MethodCall]
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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
|
-
|
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.
|
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
|
112
|
+
def render_attribute_accessor(decl) #: String
|
107
113
|
methods = []
|
108
|
-
if decl.
|
109
|
-
|
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
|
122
|
+
def render_class_attribute(decl) #: String
|
124
123
|
methods = []
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
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)
|
51
|
+
self.module&.const_defined?(:ClassMethods)
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
return
|
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
|
-
|
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
|
-
|
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 @
|
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
|
-
@
|
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:
|
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 && !
|
83
|
+
if call.type == :FCALL && call.children[0] == :included && parse_included_block && !in_included_block?
|
87
84
|
body = node.children[1].children[2]
|
88
|
-
|
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
|
110
|
-
@
|
106
|
+
def in_included_block? #: bool
|
107
|
+
@in_included_block
|
111
108
|
end
|
112
109
|
|
113
110
|
# @rbs &block: () -> void
|
114
|
-
def
|
115
|
-
@
|
111
|
+
def with_included_block(&block) #: void
|
112
|
+
@in_included_block = true
|
116
113
|
block.call
|
117
114
|
ensure
|
118
|
-
@
|
115
|
+
@in_included_block = false
|
119
116
|
end
|
120
117
|
end
|
121
118
|
end
|
data/rbs_collection.lock.yaml
CHANGED
@@ -6,7 +6,7 @@ gems:
|
|
6
6
|
source:
|
7
7
|
type: git
|
8
8
|
name: ruby/gem_rbs_collection
|
9
|
-
revision:
|
9
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
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:
|
17
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
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:
|
25
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
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:
|
33
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
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:
|
53
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
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:
|
61
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
62
62
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
63
63
|
repo_dir: gems
|
64
64
|
- name: date
|
@@ -69,6 +69,10 @@ gems:
|
|
69
69
|
version: '0'
|
70
70
|
source:
|
71
71
|
type: stdlib
|
72
|
+
- name: delegate
|
73
|
+
version: '0'
|
74
|
+
source:
|
75
|
+
type: stdlib
|
72
76
|
- name: erb
|
73
77
|
version: '0'
|
74
78
|
source:
|
@@ -82,7 +86,7 @@ gems:
|
|
82
86
|
source:
|
83
87
|
type: git
|
84
88
|
name: ruby/gem_rbs_collection
|
85
|
-
revision:
|
89
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
86
90
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
87
91
|
repo_dir: gems
|
88
92
|
- name: io-console
|
@@ -114,9 +118,13 @@ gems:
|
|
114
118
|
source:
|
115
119
|
type: git
|
116
120
|
name: ruby/gem_rbs_collection
|
117
|
-
revision:
|
121
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
118
122
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
119
123
|
repo_dir: gems
|
124
|
+
- name: openssl
|
125
|
+
version: '0'
|
126
|
+
source:
|
127
|
+
type: stdlib
|
120
128
|
- name: optparse
|
121
129
|
version: '0'
|
122
130
|
source:
|
@@ -126,7 +134,7 @@ gems:
|
|
126
134
|
source:
|
127
135
|
type: git
|
128
136
|
name: ruby/gem_rbs_collection
|
129
|
-
revision:
|
137
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
130
138
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
131
139
|
repo_dir: gems
|
132
140
|
- name: parser
|
@@ -134,7 +142,7 @@ gems:
|
|
134
142
|
source:
|
135
143
|
type: git
|
136
144
|
name: ruby/gem_rbs_collection
|
137
|
-
revision:
|
145
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
138
146
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
139
147
|
repo_dir: gems
|
140
148
|
- name: pathname
|
@@ -154,7 +162,7 @@ gems:
|
|
154
162
|
source:
|
155
163
|
type: git
|
156
164
|
name: ruby/gem_rbs_collection
|
157
|
-
revision:
|
165
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
158
166
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
159
167
|
repo_dir: gems
|
160
168
|
- name: rails-dom-testing
|
@@ -162,7 +170,15 @@ gems:
|
|
162
170
|
source:
|
163
171
|
type: git
|
164
172
|
name: ruby/gem_rbs_collection
|
165
|
-
revision:
|
173
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
174
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
175
|
+
repo_dir: gems
|
176
|
+
- name: rails-html-sanitizer
|
177
|
+
version: '1.6'
|
178
|
+
source:
|
179
|
+
type: git
|
180
|
+
name: ruby/gem_rbs_collection
|
181
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
166
182
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
167
183
|
repo_dir: gems
|
168
184
|
- name: railties
|
@@ -170,7 +186,7 @@ gems:
|
|
170
186
|
source:
|
171
187
|
type: git
|
172
188
|
name: ruby/gem_rbs_collection
|
173
|
-
revision:
|
189
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
174
190
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
175
191
|
repo_dir: gems
|
176
192
|
- name: rainbow
|
@@ -178,7 +194,7 @@ gems:
|
|
178
194
|
source:
|
179
195
|
type: git
|
180
196
|
name: ruby/gem_rbs_collection
|
181
|
-
revision:
|
197
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
182
198
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
183
199
|
repo_dir: gems
|
184
200
|
- name: rake
|
@@ -186,7 +202,7 @@ gems:
|
|
186
202
|
source:
|
187
203
|
type: git
|
188
204
|
name: ruby/gem_rbs_collection
|
189
|
-
revision:
|
205
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
190
206
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
191
207
|
repo_dir: gems
|
192
208
|
- name: rbs
|
@@ -202,7 +218,7 @@ gems:
|
|
202
218
|
source:
|
203
219
|
type: git
|
204
220
|
name: ruby/gem_rbs_collection
|
205
|
-
revision:
|
221
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
206
222
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
207
223
|
repo_dir: gems
|
208
224
|
- name: ripper
|
@@ -214,7 +230,7 @@ gems:
|
|
214
230
|
source:
|
215
231
|
type: git
|
216
232
|
name: ruby/gem_rbs_collection
|
217
|
-
revision:
|
233
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
218
234
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
219
235
|
repo_dir: gems
|
220
236
|
- name: rubocop-ast
|
@@ -222,7 +238,7 @@ gems:
|
|
222
238
|
source:
|
223
239
|
type: git
|
224
240
|
name: ruby/gem_rbs_collection
|
225
|
-
revision:
|
241
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
226
242
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
227
243
|
repo_dir: gems
|
228
244
|
- name: securerandom
|
@@ -233,6 +249,10 @@ gems:
|
|
233
249
|
version: '0'
|
234
250
|
source:
|
235
251
|
type: stdlib
|
252
|
+
- name: socket
|
253
|
+
version: '0'
|
254
|
+
source:
|
255
|
+
type: stdlib
|
236
256
|
- name: strscan
|
237
257
|
version: '0'
|
238
258
|
source:
|
@@ -246,7 +266,7 @@ gems:
|
|
246
266
|
source:
|
247
267
|
type: git
|
248
268
|
name: ruby/gem_rbs_collection
|
249
|
-
revision:
|
269
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
250
270
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
251
271
|
repo_dir: gems
|
252
272
|
- name: time
|
@@ -266,7 +286,7 @@ gems:
|
|
266
286
|
source:
|
267
287
|
type: git
|
268
288
|
name: ruby/gem_rbs_collection
|
269
|
-
revision:
|
289
|
+
revision: 5fcf7d45b7c430a651c5996280d9991c781fcf14
|
270
290
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
271
291
|
repo_dir: gems
|
272
292
|
- 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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
56
|
+
def in_included_block?: () -> bool
|
57
57
|
|
58
58
|
# @rbs &block: () -> void
|
59
|
-
def
|
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.
|
4
|
+
version: 1.4.1
|
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-
|
11
|
+
date: 2024-11-21 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
|
@@ -121,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.5.
|
125
|
-
signing_key:
|
124
|
+
rubygems_version: 3.5.22
|
125
|
+
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A RBS files generatorfor activesupport
|
128
128
|
test_files: []
|