rbs_activemodel 1.2.0 → 1.3.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/.rubocop.yml +5 -2
- data/lib/rbs_activemodel/active_model.rb +27 -2
- data/lib/rbs_activemodel/version.rb +1 -1
- data/rbs_collection.lock.yaml +38 -22
- data/sig/rbs_activemodel/active_model.rbs +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e4dc4dbc7e78453a1e28c02b840515cd7842128f8a811be4186e7d142694bc5
|
4
|
+
data.tar.gz: 360bca3add7f52c45aecb98748d993d2233b7e3ac02d09dd0c8c6e7d73a4b5b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f2bfa44a7646f724db738cba0e8aab2f4cc1c07c8841151a3cf70e64b520a20e885b022b5dda4d7d9998c878ea0d60a7eac3354ba4ca5d219ac370dbd7ecc5
|
7
|
+
data.tar.gz: 1fe675d397625b1570d1de917a9f6f32733447e4c54d36265d3645d825199d4799c9032d0860e835c88bb27c7e293090a80781a21492f130f3925a6630aba807
|
data/.rubocop.yml
CHANGED
@@ -21,7 +21,8 @@ module RbsActivemodel
|
|
21
21
|
end
|
22
22
|
|
23
23
|
class Generator
|
24
|
-
MIXINS = [::ActiveModel::Model, ::ActiveModel::Attributes,
|
24
|
+
MIXINS = [::ActiveModel::Model, ::ActiveModel::Attributes,
|
25
|
+
::ActiveModel::SecurePassword, ::ActiveModel::Validations].freeze
|
25
26
|
TYPES = {
|
26
27
|
big_integer: Integer,
|
27
28
|
binary: String,
|
@@ -42,12 +43,14 @@ module RbsActivemodel
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def generate
|
45
|
-
return if mixins.empty? && attributes.empty?
|
46
|
+
return if mixins.empty? && secure_password.empty? && attributes.empty?
|
46
47
|
|
47
48
|
format <<~RBS
|
48
49
|
#{header}
|
49
50
|
#{mixins}
|
50
51
|
|
52
|
+
#{secure_password}
|
53
|
+
|
51
54
|
#{attributes}
|
52
55
|
#{footer}
|
53
56
|
RBS
|
@@ -85,6 +88,28 @@ module RbsActivemodel
|
|
85
88
|
end.join("\n")
|
86
89
|
end
|
87
90
|
|
91
|
+
def secure_password
|
92
|
+
return "" if klass.ancestors.none?(::ActiveModel::SecurePassword::InstanceMethodsOnActivation)
|
93
|
+
|
94
|
+
methods = klass.instance_methods.grep(/^authenticate_/)
|
95
|
+
@secure_password ||= methods.filter_map do |method_name|
|
96
|
+
attribute = method_name.to_s.split("_").last
|
97
|
+
next unless klass.instance_methods.include?(:"#{attribute}_confirmation")
|
98
|
+
|
99
|
+
<<~RBS
|
100
|
+
attr_reader #{attribute}: String?
|
101
|
+
attr_accessor #{attribute}_confirmation: String
|
102
|
+
attr_accessor #{attribute}_challenge: String
|
103
|
+
|
104
|
+
def #{attribute}=: (String) -> String
|
105
|
+
def #{attribute}_salt: () -> String
|
106
|
+
def authenticate_#{attribute}: (String) -> (instance | false)
|
107
|
+
|
108
|
+
#{"alias authenticate authenticate_password" if attribute == "password"}
|
109
|
+
RBS
|
110
|
+
end.join("\n")
|
111
|
+
end
|
112
|
+
|
88
113
|
def mixins
|
89
114
|
return "" if klass < ActiveRecord::Base
|
90
115
|
|
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: e9bc1bf94c262e79a2d599a9c173342915b29808
|
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: e9bc1bf94c262e79a2d599a9c173342915b29808
|
18
18
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
19
19
|
repo_dir: gems
|
20
20
|
- name: activemodel
|
@@ -22,7 +22,7 @@ gems:
|
|
22
22
|
source:
|
23
23
|
type: git
|
24
24
|
name: ruby/gem_rbs_collection
|
25
|
-
revision:
|
25
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
26
26
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
27
27
|
repo_dir: gems
|
28
28
|
- name: activerecord
|
@@ -30,7 +30,7 @@ gems:
|
|
30
30
|
source:
|
31
31
|
type: git
|
32
32
|
name: ruby/gem_rbs_collection
|
33
|
-
revision:
|
33
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
34
34
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
35
35
|
repo_dir: gems
|
36
36
|
- name: activesupport
|
@@ -38,7 +38,7 @@ gems:
|
|
38
38
|
source:
|
39
39
|
type: git
|
40
40
|
name: ruby/gem_rbs_collection
|
41
|
-
revision:
|
41
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
42
42
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
43
43
|
repo_dir: gems
|
44
44
|
- name: ast
|
@@ -46,13 +46,21 @@ gems:
|
|
46
46
|
source:
|
47
47
|
type: git
|
48
48
|
name: ruby/gem_rbs_collection
|
49
|
-
revision:
|
49
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
50
50
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
51
51
|
repo_dir: gems
|
52
52
|
- name: base64
|
53
53
|
version: '0'
|
54
54
|
source:
|
55
55
|
type: stdlib
|
56
|
+
- name: bcrypt
|
57
|
+
version: '3.1'
|
58
|
+
source:
|
59
|
+
type: git
|
60
|
+
name: ruby/gem_rbs_collection
|
61
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
62
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
63
|
+
repo_dir: gems
|
56
64
|
- name: bigdecimal
|
57
65
|
version: '0'
|
58
66
|
source:
|
@@ -66,7 +74,7 @@ gems:
|
|
66
74
|
source:
|
67
75
|
type: git
|
68
76
|
name: ruby/gem_rbs_collection
|
69
|
-
revision:
|
77
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
70
78
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
71
79
|
repo_dir: gems
|
72
80
|
- name: connection_pool
|
@@ -74,7 +82,7 @@ gems:
|
|
74
82
|
source:
|
75
83
|
type: git
|
76
84
|
name: ruby/gem_rbs_collection
|
77
|
-
revision:
|
85
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
78
86
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
79
87
|
repo_dir: gems
|
80
88
|
- name: date
|
@@ -98,7 +106,7 @@ gems:
|
|
98
106
|
source:
|
99
107
|
type: git
|
100
108
|
name: ruby/gem_rbs_collection
|
101
|
-
revision:
|
109
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
102
110
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
103
111
|
repo_dir: gems
|
104
112
|
- name: io-console
|
@@ -130,9 +138,13 @@ gems:
|
|
130
138
|
source:
|
131
139
|
type: git
|
132
140
|
name: ruby/gem_rbs_collection
|
133
|
-
revision:
|
141
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
134
142
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
135
143
|
repo_dir: gems
|
144
|
+
- name: openssl
|
145
|
+
version: '0'
|
146
|
+
source:
|
147
|
+
type: stdlib
|
136
148
|
- name: optparse
|
137
149
|
version: '0'
|
138
150
|
source:
|
@@ -142,7 +154,7 @@ gems:
|
|
142
154
|
source:
|
143
155
|
type: git
|
144
156
|
name: ruby/gem_rbs_collection
|
145
|
-
revision:
|
157
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
146
158
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
147
159
|
repo_dir: gems
|
148
160
|
- name: parser
|
@@ -150,7 +162,7 @@ gems:
|
|
150
162
|
source:
|
151
163
|
type: git
|
152
164
|
name: ruby/gem_rbs_collection
|
153
|
-
revision:
|
165
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
154
166
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
155
167
|
repo_dir: gems
|
156
168
|
- name: pathname
|
@@ -170,7 +182,7 @@ gems:
|
|
170
182
|
source:
|
171
183
|
type: git
|
172
184
|
name: ruby/gem_rbs_collection
|
173
|
-
revision:
|
185
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
174
186
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
175
187
|
repo_dir: gems
|
176
188
|
- name: rails-dom-testing
|
@@ -178,7 +190,7 @@ gems:
|
|
178
190
|
source:
|
179
191
|
type: git
|
180
192
|
name: ruby/gem_rbs_collection
|
181
|
-
revision:
|
193
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
182
194
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
183
195
|
repo_dir: gems
|
184
196
|
- name: railties
|
@@ -186,7 +198,7 @@ gems:
|
|
186
198
|
source:
|
187
199
|
type: git
|
188
200
|
name: ruby/gem_rbs_collection
|
189
|
-
revision:
|
201
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
190
202
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
191
203
|
repo_dir: gems
|
192
204
|
- name: rainbow
|
@@ -194,7 +206,7 @@ gems:
|
|
194
206
|
source:
|
195
207
|
type: git
|
196
208
|
name: ruby/gem_rbs_collection
|
197
|
-
revision:
|
209
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
198
210
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
199
211
|
repo_dir: gems
|
200
212
|
- name: rake
|
@@ -202,7 +214,7 @@ gems:
|
|
202
214
|
source:
|
203
215
|
type: git
|
204
216
|
name: ruby/gem_rbs_collection
|
205
|
-
revision:
|
217
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
206
218
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
207
219
|
repo_dir: gems
|
208
220
|
- name: rbs
|
@@ -218,7 +230,7 @@ gems:
|
|
218
230
|
source:
|
219
231
|
type: git
|
220
232
|
name: ruby/gem_rbs_collection
|
221
|
-
revision:
|
233
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
222
234
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
223
235
|
repo_dir: gems
|
224
236
|
- name: rubocop
|
@@ -226,7 +238,7 @@ gems:
|
|
226
238
|
source:
|
227
239
|
type: git
|
228
240
|
name: ruby/gem_rbs_collection
|
229
|
-
revision:
|
241
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
230
242
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
231
243
|
repo_dir: gems
|
232
244
|
- name: rubocop-ast
|
@@ -234,7 +246,7 @@ gems:
|
|
234
246
|
source:
|
235
247
|
type: git
|
236
248
|
name: ruby/gem_rbs_collection
|
237
|
-
revision:
|
249
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
238
250
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
239
251
|
repo_dir: gems
|
240
252
|
- name: securerandom
|
@@ -245,6 +257,10 @@ gems:
|
|
245
257
|
version: '0'
|
246
258
|
source:
|
247
259
|
type: stdlib
|
260
|
+
- name: socket
|
261
|
+
version: '0'
|
262
|
+
source:
|
263
|
+
type: stdlib
|
248
264
|
- name: strscan
|
249
265
|
version: '0'
|
250
266
|
source:
|
@@ -258,7 +274,7 @@ gems:
|
|
258
274
|
source:
|
259
275
|
type: git
|
260
276
|
name: ruby/gem_rbs_collection
|
261
|
-
revision:
|
277
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
262
278
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
263
279
|
repo_dir: gems
|
264
280
|
- name: time
|
@@ -278,7 +294,7 @@ gems:
|
|
278
294
|
source:
|
279
295
|
type: git
|
280
296
|
name: ruby/gem_rbs_collection
|
281
|
-
revision:
|
297
|
+
revision: e9bc1bf94c262e79a2d599a9c173342915b29808
|
282
298
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
283
299
|
repo_dir: gems
|
284
300
|
- name: uri
|
@@ -7,6 +7,7 @@ module RbsActivemodel
|
|
7
7
|
MIXINS: Array[Module]
|
8
8
|
TYPES: Hash[Symbol, Class | String | Symbol]
|
9
9
|
|
10
|
+
@secure_password: String
|
10
11
|
@mixins: String
|
11
12
|
@attributes: String
|
12
13
|
|
@@ -20,6 +21,7 @@ module RbsActivemodel
|
|
20
21
|
|
21
22
|
def format: (String rbs) -> String
|
22
23
|
def header: () -> String
|
24
|
+
def secure_password: () -> String
|
23
25
|
def mixins: () -> String
|
24
26
|
def attributes: () -> String
|
25
27
|
def footer: () -> String
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi KOMIYA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.5.
|
130
|
+
rubygems_version: 3.5.16
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: A RBS files generator for activemodel gem
|