@@ -73,19 +73,19 @@ class Student
73
73
include FrozenRecordAttributeMethods
74
74
75
75
module FrozenRecordAttributeMethods
76
- sig { returns(T.untyped ) }
76
+ sig { returns(String ) }
77
77
def first_name; end
78
78
79
79
sig { returns(T::Boolean) }
80
80
def first_name?; end
81
81
82
- sig { returns(T.untyped ) }
82
+ sig { returns(Integer ) }
83
83
def id; end
84
84
85
85
sig { returns(T::Boolean) }
86
86
def id?; end
87
87
88
- sig { returns(T.untyped ) }
88
+ sig { returns(String ) }
89
89
def last_name; end
90
90
91
91
sig { returns(T::Boolean) }
@@ -106,25 +106,7 @@ class Student < FrozenRecord::Base
106
106
107
107
self.base_path = __dir__
108
108
109
- sig { returns(String) }
110
- def first_name
111
- super
112
- end
113
-
114
- sig { returns(String) }
115
- def last_name
116
- super
117
- end
118
-
119
- sig { returns(String) }
120
- def location
121
- super
122
- end
123
-
124
- sig { returns(Integer) }
125
- def age
126
- return super + 5
127
- end
109
+ self.default_attributes = { shirt_size: :large }
128
110
129
111
sig { params(grain: Symbol).returns(String) }
130
112
def area(grain:)
@@ -149,11 +131,27 @@ def area(grain:)
149
131
last_name: Smith
150
132
age: 19
151
133
location: Ottawa, Ontario, Canada
134
+ is_cool_person: no
135
+ birth_date: 1867-07-01
136
+ updated_at: 2014-02-24T19:08:06-05:00
137
+ favourite_foods:
138
+ - Pizza
139
+ skills:
140
+ backend: Ruby
141
+ frontend: HTML
152
142
- id: 2
153
143
first_name: Dan
154
144
last_name: Lord
155
145
age: 20
156
146
location: Toronto, Ontario, Canada
147
+ is_cool_person: yes
148
+ birth_date: 1967-07-01
149
+ updated_at: 2015-02-24T19:08:06-05:00
150
+ favourite_foods:
151
+ - Tacos
152
+ skills:
153
+ backend: Ruby
154
+ frontend: CSS
157
155
YAML
158
156
159
157
expected = <<~RBI
@@ -163,38 +161,71 @@ class Student
163
161
include FrozenRecordAttributeMethods
164
162
165
163
module FrozenRecordAttributeMethods
166
- sig { returns(:: Integer) }
164
+ sig { returns(Integer) }
167
165
def age; end
168
166
169
167
sig { returns(T::Boolean) }
170
168
def age?; end
171
169
172
- sig { params(grain: ::Symbol). returns(::String ) }
173
- def area(grain:) ; end
170
+ sig { returns(Date ) }
171
+ def birth_date ; end
174
172
175
- sig { returns(::String) }
173
+ sig { returns(T::Boolean) }
174
+ def birth_date?; end
175
+
176
+ sig { returns(Array) }
177
+ def favourite_foods; end
178
+
179
+ sig { returns(T::Boolean) }
180
+ def favourite_foods?; end
181
+
182
+ sig { returns(String) }
176
183
def first_name; end
177
184
178
185
sig { returns(T::Boolean) }
179
186
def first_name?; end
180
187
181
- sig { returns(T.untyped ) }
188
+ sig { returns(Integer ) }
182
189
def id; end
183
190
184
191
sig { returns(T::Boolean) }
185
192
def id?; end
186
193
187
- sig { returns(::String) }
194
+ sig { returns(T::Boolean) }
195
+ def is_cool_person; end
196
+
197
+ sig { returns(T::Boolean) }
198
+ def is_cool_person?; end
199
+
200
+ sig { returns(String) }
188
201
def last_name; end
189
202
190
203
sig { returns(T::Boolean) }
191
204
def last_name?; end
192
205
193
- sig { returns(:: String) }
206
+ sig { returns(String) }
194
207
def location; end
195
208
196
209
sig { returns(T::Boolean) }
197
210
def location?; end
211
+
212
+ sig { returns(Symbol) }
213
+ def shirt_size; end
214
+
215
+ sig { returns(T::Boolean) }
216
+ def shirt_size?; end
217
+
218
+ sig { returns(Hash) }
219
+ def skills; end
220
+
221
+ sig { returns(T::Boolean) }
222
+ def skills?; end
223
+
224
+ sig { returns(Time) }
225
+ def updated_at; end
226
+
227
+ sig { returns(T::Boolean) }
228
+ def updated_at?; end
198
229
end
199
230
end
200
231
RBI
@@ -226,13 +257,13 @@ class Student
226
257
extend GeneratedRelationMethods
227
258
228
259
module FrozenRecordAttributeMethods
229
- sig { returns(T.untyped ) }
260
+ sig { returns(String ) }
230
261
def course; end
231
262
232
263
sig { returns(T::Boolean) }
233
264
def course?; end
234
265
235
- sig { returns(T.untyped ) }
266
+ sig { returns(Integer ) }
236
267
def id; end
237
268
238
269
sig { returns(T::Boolean) }
0 commit comments