rbs_active_hash 1.4.1 → 1.6.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 +4 -4
- data/.rubocop.yml +15 -1
- data/.vscode/settings.json +17 -3
- data/Gemfile +5 -2
- data/Gemfile.lock +157 -99
- data/Steepfile +1 -0
- data/lib/generators/rbs_active_hash/install_generator.rb +1 -1
- data/lib/rbs_active_hash/active_hash/parser.rb +21 -10
- data/lib/rbs_active_hash/active_hash.rb +42 -29
- data/lib/rbs_active_hash/rake_task.rb +10 -7
- data/lib/rbs_active_hash/version.rb +1 -1
- data/rbs_collection.lock.yaml +134 -36
- data/sig/generators/rbs_active_hash/install_generator.rbs +2 -0
- data/sig/rbs_active_hash/active_hash/parser.rbs +23 -4
- data/sig/rbs_active_hash/active_hash.rbs +39 -6
- data/sig/rbs_active_hash/rake_task.rbs +8 -3
- data/sig/rbs_active_hash/version.rbs +5 -0
- data/sig/rbs_active_hash.rbs +2 -2
- metadata +9 -9
- data/rbs_active_hash.gemspec +0 -35
- data/sig/shims/rake.rbs +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c72503e55cdd29dfb738e4cf1154b5673de210dabcb9c987770020f6421b37fb
|
|
4
|
+
data.tar.gz: 3f8b643bf0c6febc8d74b9139dc7db95a40feba1976c4213634ab4ba3e2c53cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ec043fdcc777e755c87b739a432e01769520f7eff3d9137dbe054c260c632def1bd5aa13b5cd81a29f95f960408caa6231f6db0ea77c430f92d63260ed90342
|
|
7
|
+
data.tar.gz: 6892cf7036260f002def3aeaf016529b40f401ec78e03e539ef5d61a7ad56a12d89c77901ba3b08f04e8cf33cb5c93fffbf7bddb248aaa2a5cfe891850ebe87f
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion: 2
|
|
2
|
+
TargetRubyVersion: 3.2
|
|
3
|
+
NewCops: enable
|
|
4
|
+
|
|
5
|
+
plugins:
|
|
6
|
+
- rubocop-rake
|
|
7
|
+
- rubocop-rspec
|
|
3
8
|
|
|
4
9
|
Style/Documentation:
|
|
5
10
|
Enabled: false
|
|
@@ -12,6 +17,9 @@ Style/StringLiteralsInInterpolation:
|
|
|
12
17
|
Enabled: true
|
|
13
18
|
EnforcedStyle: double_quotes
|
|
14
19
|
|
|
20
|
+
Layout/LeadingCommentSpace:
|
|
21
|
+
AllowRBSInlineAnnotation: true
|
|
22
|
+
|
|
15
23
|
Layout/LineLength:
|
|
16
24
|
Max: 120
|
|
17
25
|
|
|
@@ -33,3 +41,9 @@ Metrics/MethodLength:
|
|
|
33
41
|
|
|
34
42
|
Metrics/PerceivedComplexity:
|
|
35
43
|
Max: 10
|
|
44
|
+
|
|
45
|
+
RSpec/NamedSubject:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
RSpec/MultipleExpectations:
|
|
49
|
+
Max: 10
|
data/.vscode/settings.json
CHANGED
|
@@ -2,8 +2,22 @@
|
|
|
2
2
|
"[ruby]": {
|
|
3
3
|
"editor.defaultFormatter": "Shopify.ruby-lsp"
|
|
4
4
|
},
|
|
5
|
-
"rbs-helper.signature-directory": "sig",
|
|
6
5
|
"cSpell.words": [
|
|
7
|
-
"
|
|
8
|
-
|
|
6
|
+
"activerecord",
|
|
7
|
+
"bindir",
|
|
8
|
+
"boolish",
|
|
9
|
+
"Colour",
|
|
10
|
+
"Cyclomatic",
|
|
11
|
+
"FCALL",
|
|
12
|
+
"klass",
|
|
13
|
+
"KOMIYA",
|
|
14
|
+
"raketask",
|
|
15
|
+
"rubocop",
|
|
16
|
+
"rubygems",
|
|
17
|
+
"Takeshi",
|
|
18
|
+
"tk0miya",
|
|
19
|
+
"VCALL"
|
|
20
|
+
],
|
|
21
|
+
"rbs-helper.rbs-inline-signature-directory": "sig/",
|
|
22
|
+
"rbs-helper.rbs-inline-on-save": true
|
|
9
23
|
}
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,11 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in rbs_active_hash.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem "rake", "~> 13.
|
|
8
|
+
gem "rake", "~> 13.3"
|
|
9
9
|
|
|
10
|
-
gem "rubocop", "~> 1.
|
|
10
|
+
gem "rubocop", "~> 1.81"
|
|
11
|
+
gem "rubocop-rake"
|
|
12
|
+
gem "rubocop-rspec"
|
|
11
13
|
|
|
12
14
|
group :test do
|
|
13
15
|
gem "activerecord"
|
|
@@ -17,6 +19,7 @@ group :development do
|
|
|
17
19
|
gem "rspec", require: false
|
|
18
20
|
gem "rspec-daemon", require: false
|
|
19
21
|
|
|
22
|
+
gem "rbs-inline", require: false
|
|
20
23
|
gem "steep"
|
|
21
24
|
end
|
|
22
25
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,169 +1,227 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rbs_active_hash (1.
|
|
4
|
+
rbs_active_hash (1.6.0)
|
|
5
5
|
active_hash
|
|
6
6
|
rbs
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
actionpack (7.
|
|
12
|
-
actionview (= 7.
|
|
13
|
-
activesupport (= 7.
|
|
14
|
-
|
|
11
|
+
actionpack (7.2.2.2)
|
|
12
|
+
actionview (= 7.2.2.2)
|
|
13
|
+
activesupport (= 7.2.2.2)
|
|
14
|
+
nokogiri (>= 1.8.5)
|
|
15
|
+
racc
|
|
16
|
+
rack (>= 2.2.4, < 3.2)
|
|
17
|
+
rack-session (>= 1.0.1)
|
|
15
18
|
rack-test (>= 0.6.3)
|
|
16
|
-
rails-dom-testing (~> 2.
|
|
17
|
-
rails-html-sanitizer (~> 1.
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
rails-dom-testing (~> 2.2)
|
|
20
|
+
rails-html-sanitizer (~> 1.6)
|
|
21
|
+
useragent (~> 0.16)
|
|
22
|
+
actionview (7.2.2.2)
|
|
23
|
+
activesupport (= 7.2.2.2)
|
|
20
24
|
builder (~> 3.1)
|
|
21
|
-
erubi (~> 1.
|
|
22
|
-
rails-dom-testing (~> 2.
|
|
23
|
-
rails-html-sanitizer (~> 1.
|
|
24
|
-
active_hash (
|
|
25
|
-
activesupport (>=
|
|
26
|
-
activemodel (7.
|
|
27
|
-
activesupport (= 7.
|
|
28
|
-
activerecord (7.
|
|
29
|
-
activemodel (= 7.
|
|
30
|
-
activesupport (= 7.
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
erubi (~> 1.11)
|
|
26
|
+
rails-dom-testing (~> 2.2)
|
|
27
|
+
rails-html-sanitizer (~> 1.6)
|
|
28
|
+
active_hash (4.0.0)
|
|
29
|
+
activesupport (>= 6.1.0)
|
|
30
|
+
activemodel (7.2.2.2)
|
|
31
|
+
activesupport (= 7.2.2.2)
|
|
32
|
+
activerecord (7.2.2.2)
|
|
33
|
+
activemodel (= 7.2.2.2)
|
|
34
|
+
activesupport (= 7.2.2.2)
|
|
35
|
+
timeout (>= 0.4.0)
|
|
36
|
+
activesupport (7.2.2.2)
|
|
37
|
+
base64
|
|
38
|
+
benchmark (>= 0.3)
|
|
39
|
+
bigdecimal
|
|
40
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
41
|
+
connection_pool (>= 2.2.5)
|
|
42
|
+
drb
|
|
33
43
|
i18n (>= 1.6, < 2)
|
|
44
|
+
logger (>= 1.4.2)
|
|
34
45
|
minitest (>= 5.1)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
securerandom (>= 0.3)
|
|
47
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
48
|
+
ast (2.4.3)
|
|
49
|
+
base64 (0.3.0)
|
|
50
|
+
benchmark (0.4.1)
|
|
51
|
+
bigdecimal (3.2.2)
|
|
52
|
+
builder (3.3.0)
|
|
53
|
+
concurrent-ruby (1.3.5)
|
|
54
|
+
connection_pool (2.5.3)
|
|
41
55
|
crass (1.0.6)
|
|
42
|
-
csv (3.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
csv (3.3.3)
|
|
57
|
+
date (3.4.1)
|
|
58
|
+
diff-lcs (1.6.2)
|
|
59
|
+
drb (2.2.3)
|
|
60
|
+
erubi (1.13.0)
|
|
61
|
+
ffi (1.17.1-arm64-darwin)
|
|
62
|
+
ffi (1.17.1-x86_64-darwin)
|
|
63
|
+
ffi (1.17.1-x86_64-linux-gnu)
|
|
64
|
+
fileutils (1.7.3)
|
|
65
|
+
i18n (1.14.7)
|
|
48
66
|
concurrent-ruby (~> 1.0)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
io-console (0.8.0)
|
|
68
|
+
irb (1.14.2)
|
|
69
|
+
rdoc (>= 4.0.0)
|
|
70
|
+
reline (>= 0.4.2)
|
|
71
|
+
json (2.15.0)
|
|
72
|
+
language_server-protocol (3.17.0.5)
|
|
73
|
+
lint_roller (1.1.0)
|
|
74
|
+
listen (3.9.0)
|
|
52
75
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
53
76
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
54
|
-
logger (1.
|
|
55
|
-
loofah (2.
|
|
77
|
+
logger (1.7.0)
|
|
78
|
+
loofah (2.23.1)
|
|
56
79
|
crass (~> 1.0.2)
|
|
57
80
|
nokogiri (>= 1.12.0)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
nokogiri (1.
|
|
81
|
+
minitest (5.25.5)
|
|
82
|
+
mutex_m (0.3.0)
|
|
83
|
+
nokogiri (1.18.9-arm64-darwin)
|
|
84
|
+
racc (~> 1.4)
|
|
85
|
+
nokogiri (1.18.9-x86_64-darwin)
|
|
61
86
|
racc (~> 1.4)
|
|
62
|
-
nokogiri (1.
|
|
87
|
+
nokogiri (1.18.9-x86_64-linux-gnu)
|
|
63
88
|
racc (~> 1.4)
|
|
64
|
-
parallel (1.
|
|
65
|
-
parser (3.
|
|
89
|
+
parallel (1.27.0)
|
|
90
|
+
parser (3.3.9.0)
|
|
66
91
|
ast (~> 2.4.1)
|
|
67
92
|
racc
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
93
|
+
prism (1.5.1)
|
|
94
|
+
psych (5.2.1)
|
|
95
|
+
date
|
|
96
|
+
stringio
|
|
97
|
+
racc (1.8.1)
|
|
98
|
+
rack (3.1.16)
|
|
99
|
+
rack-session (2.1.1)
|
|
100
|
+
base64 (>= 0.1.0)
|
|
101
|
+
rack (>= 3.0.0)
|
|
73
102
|
rack-test (2.1.0)
|
|
74
103
|
rack (>= 1.3)
|
|
104
|
+
rackup (2.2.1)
|
|
105
|
+
rack (>= 3)
|
|
75
106
|
rails-dom-testing (2.2.0)
|
|
76
107
|
activesupport (>= 5.0.0)
|
|
77
108
|
minitest
|
|
78
109
|
nokogiri (>= 1.6)
|
|
79
|
-
rails-html-sanitizer (1.6.
|
|
110
|
+
rails-html-sanitizer (1.6.2)
|
|
80
111
|
loofah (~> 2.21)
|
|
81
|
-
nokogiri (
|
|
82
|
-
railties (7.
|
|
83
|
-
actionpack (= 7.
|
|
84
|
-
activesupport (= 7.
|
|
85
|
-
|
|
112
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
113
|
+
railties (7.2.2.2)
|
|
114
|
+
actionpack (= 7.2.2.2)
|
|
115
|
+
activesupport (= 7.2.2.2)
|
|
116
|
+
irb (~> 1.13)
|
|
117
|
+
rackup (>= 1.0.0)
|
|
86
118
|
rake (>= 12.2)
|
|
87
|
-
thor (~> 1.0)
|
|
88
|
-
zeitwerk (~> 2.
|
|
119
|
+
thor (~> 1.0, >= 1.2.2)
|
|
120
|
+
zeitwerk (~> 2.6)
|
|
89
121
|
rainbow (3.1.1)
|
|
90
|
-
rake (13.0
|
|
122
|
+
rake (13.3.0)
|
|
91
123
|
rb-fsevent (0.11.2)
|
|
92
|
-
rb-inotify (0.
|
|
124
|
+
rb-inotify (0.11.1)
|
|
93
125
|
ffi (~> 1.0)
|
|
94
|
-
rbs (3.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
126
|
+
rbs (3.9.5)
|
|
127
|
+
logger
|
|
128
|
+
rbs-inline (0.12.0)
|
|
129
|
+
prism (>= 0.29)
|
|
130
|
+
rbs (>= 3.8.0)
|
|
131
|
+
rdoc (6.9.0)
|
|
132
|
+
psych (>= 4.0.0)
|
|
133
|
+
regexp_parser (2.11.3)
|
|
134
|
+
reline (0.5.12)
|
|
135
|
+
io-console (~> 0.5)
|
|
136
|
+
rspec (3.13.1)
|
|
137
|
+
rspec-core (~> 3.13.0)
|
|
138
|
+
rspec-expectations (~> 3.13.0)
|
|
139
|
+
rspec-mocks (~> 3.13.0)
|
|
140
|
+
rspec-core (3.13.4)
|
|
141
|
+
rspec-support (~> 3.13.0)
|
|
142
|
+
rspec-daemon (1.1.1)
|
|
105
143
|
rspec
|
|
106
|
-
rspec-expectations (3.
|
|
144
|
+
rspec-expectations (3.13.5)
|
|
107
145
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
108
|
-
rspec-support (~> 3.
|
|
109
|
-
rspec-mocks (3.
|
|
146
|
+
rspec-support (~> 3.13.0)
|
|
147
|
+
rspec-mocks (3.13.5)
|
|
110
148
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
111
|
-
rspec-support (~> 3.
|
|
112
|
-
rspec-support (3.
|
|
113
|
-
rubocop (1.
|
|
114
|
-
base64 (~> 0.1.1)
|
|
149
|
+
rspec-support (~> 3.13.0)
|
|
150
|
+
rspec-support (3.13.4)
|
|
151
|
+
rubocop (1.81.1)
|
|
115
152
|
json (~> 2.3)
|
|
116
|
-
language_server-protocol (
|
|
153
|
+
language_server-protocol (~> 3.17.0.2)
|
|
154
|
+
lint_roller (~> 1.1.0)
|
|
117
155
|
parallel (~> 1.10)
|
|
118
|
-
parser (>= 3.
|
|
156
|
+
parser (>= 3.3.0.2)
|
|
119
157
|
rainbow (>= 2.2.2, < 4.0)
|
|
120
|
-
regexp_parser (>=
|
|
121
|
-
|
|
122
|
-
rubocop-ast (>= 1.28.1, < 2.0)
|
|
158
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
159
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
123
160
|
ruby-progressbar (~> 1.7)
|
|
124
|
-
unicode-display_width (>= 2.4.0, <
|
|
125
|
-
rubocop-ast (1.
|
|
126
|
-
parser (>= 3.
|
|
161
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
162
|
+
rubocop-ast (1.47.1)
|
|
163
|
+
parser (>= 3.3.7.2)
|
|
164
|
+
prism (~> 1.4)
|
|
165
|
+
rubocop-rake (0.7.1)
|
|
166
|
+
lint_roller (~> 1.1)
|
|
167
|
+
rubocop (>= 1.72.1)
|
|
168
|
+
rubocop-rspec (3.7.0)
|
|
169
|
+
lint_roller (~> 1.1)
|
|
170
|
+
rubocop (~> 1.72, >= 1.72.1)
|
|
127
171
|
ruby-progressbar (1.13.0)
|
|
128
|
-
securerandom (0.
|
|
129
|
-
steep (1.
|
|
172
|
+
securerandom (0.4.1)
|
|
173
|
+
steep (1.10.0)
|
|
130
174
|
activesupport (>= 5.1)
|
|
131
175
|
concurrent-ruby (>= 1.1.10)
|
|
132
176
|
csv (>= 3.0.9)
|
|
133
177
|
fileutils (>= 1.1.0)
|
|
134
178
|
json (>= 2.1.0)
|
|
135
|
-
language_server-protocol (>= 3.
|
|
179
|
+
language_server-protocol (>= 3.17.0.4, < 4.0)
|
|
136
180
|
listen (~> 3.0)
|
|
137
181
|
logger (>= 1.3.0)
|
|
182
|
+
mutex_m (>= 0.3.0)
|
|
138
183
|
parser (>= 3.1)
|
|
139
184
|
rainbow (>= 2.2.2, < 4.0)
|
|
140
|
-
rbs (
|
|
185
|
+
rbs (~> 3.9)
|
|
141
186
|
securerandom (>= 0.1)
|
|
142
187
|
strscan (>= 1.0.0)
|
|
143
|
-
terminal-table (>= 2, <
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
188
|
+
terminal-table (>= 2, < 5)
|
|
189
|
+
uri (>= 0.12.0)
|
|
190
|
+
stringio (3.1.2)
|
|
191
|
+
strscan (3.1.2)
|
|
192
|
+
terminal-table (4.0.0)
|
|
193
|
+
unicode-display_width (>= 1.1.1, < 4)
|
|
194
|
+
thor (1.3.2)
|
|
195
|
+
timeout (0.4.3)
|
|
148
196
|
tzinfo (2.0.6)
|
|
149
197
|
concurrent-ruby (~> 1.0)
|
|
150
|
-
unicode-display_width (2.
|
|
151
|
-
|
|
198
|
+
unicode-display_width (3.2.0)
|
|
199
|
+
unicode-emoji (~> 4.1)
|
|
200
|
+
unicode-emoji (4.1.0)
|
|
201
|
+
uri (1.0.3)
|
|
202
|
+
useragent (0.16.11)
|
|
203
|
+
zeitwerk (2.6.18)
|
|
152
204
|
|
|
153
205
|
PLATFORMS
|
|
206
|
+
arm64-darwin-24
|
|
154
207
|
x86_64-darwin-19
|
|
155
208
|
x86_64-darwin-21
|
|
209
|
+
x86_64-darwin-23
|
|
210
|
+
x86_64-darwin-24
|
|
156
211
|
x86_64-linux
|
|
157
212
|
|
|
158
213
|
DEPENDENCIES
|
|
159
214
|
activerecord
|
|
160
215
|
railties
|
|
161
|
-
rake (~> 13.
|
|
216
|
+
rake (~> 13.3)
|
|
217
|
+
rbs-inline
|
|
162
218
|
rbs_active_hash!
|
|
163
219
|
rspec
|
|
164
220
|
rspec-daemon
|
|
165
|
-
rubocop (~> 1.
|
|
221
|
+
rubocop (~> 1.81)
|
|
222
|
+
rubocop-rake
|
|
223
|
+
rubocop-rspec
|
|
166
224
|
steep
|
|
167
225
|
|
|
168
226
|
BUNDLED WITH
|
|
169
|
-
2.
|
|
227
|
+
2.3.27
|
data/Steepfile
CHANGED
|
@@ -12,6 +12,7 @@ module RbsActiveHash
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
class RB < RBS::Prototype::RB
|
|
15
|
+
# @rbs override
|
|
15
16
|
def process(node, decls:, comments:, context:)
|
|
16
17
|
case node.type
|
|
17
18
|
when :FCALL, :VCALL
|
|
@@ -42,16 +43,21 @@ module RbsActiveHash
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
class Parser
|
|
45
|
-
attr_reader :has_many
|
|
46
|
+
attr_reader :has_many #: Array[[Symbol, Hash[untyped, untyped]]]
|
|
47
|
+
attr_reader :has_one #: Array[[Symbol, Hash[untyped, untyped]]]
|
|
48
|
+
attr_reader :belongs_to #: Array[[Symbol, Hash[untyped, untyped]]]
|
|
49
|
+
attr_reader :scopes #: Array[[Symbol, Hash[untyped, untyped]]]
|
|
46
50
|
|
|
47
|
-
def initialize
|
|
51
|
+
def initialize #: void
|
|
48
52
|
@has_many = []
|
|
49
53
|
@has_one = []
|
|
50
54
|
@belongs_to = []
|
|
51
55
|
@scopes = []
|
|
52
56
|
end
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
# @rbs string: String
|
|
59
|
+
# @rbs target: Array[Symbol]
|
|
60
|
+
def parse(string, target) #: void
|
|
55
61
|
parser = RB.new
|
|
56
62
|
parser.parse(string)
|
|
57
63
|
parser.decls.each do |decl|
|
|
@@ -59,7 +65,9 @@ module RbsActiveHash
|
|
|
59
65
|
end
|
|
60
66
|
end
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
# @rbs node: RBS::AST::Declarations::t | RBS::AST::Members::t
|
|
69
|
+
# @rbs target: Array[Symbol]
|
|
70
|
+
def process(node, target) #: void
|
|
63
71
|
case node
|
|
64
72
|
when RBS::AST::Declarations::Module, RBS::AST::Declarations::Class
|
|
65
73
|
name = node.name.split
|
|
@@ -75,7 +83,8 @@ module RbsActiveHash
|
|
|
75
83
|
end
|
|
76
84
|
end
|
|
77
85
|
|
|
78
|
-
|
|
86
|
+
# @rbs node: AssociationDefinition
|
|
87
|
+
def process_association_definition(node) #: void
|
|
79
88
|
case node.name.name
|
|
80
89
|
when :has_many
|
|
81
90
|
association_id, args = node_to_literal(node.args)
|
|
@@ -89,21 +98,23 @@ module RbsActiveHash
|
|
|
89
98
|
end
|
|
90
99
|
end
|
|
91
100
|
|
|
92
|
-
|
|
101
|
+
# @rbs node: ScopeDefinition
|
|
102
|
+
def process_scope_definition(node) #: void
|
|
93
103
|
scope_id, args = node_to_literal(node.args)
|
|
94
|
-
@scopes << [scope_id, args
|
|
104
|
+
@scopes << [scope_id, args]
|
|
95
105
|
end
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
# @rbs node: untyped
|
|
108
|
+
def node_to_literal(node) #: untyped
|
|
98
109
|
case node.type
|
|
99
110
|
when :LIST
|
|
100
111
|
node.children[...-1].map { |child| node_to_literal(child) }
|
|
101
|
-
when :LIT, :STR
|
|
112
|
+
when :LIT, :STR, :SYM
|
|
102
113
|
node.children.first
|
|
103
114
|
when :HASH
|
|
104
115
|
Hash[*node_to_literal(node.children.first)]
|
|
105
116
|
when :LAMBDA
|
|
106
|
-
|
|
117
|
+
node.children.first.children.first # Convert to the list of argument names
|
|
107
118
|
else
|
|
108
119
|
node
|
|
109
120
|
end
|