sorbet-rails 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +13 -1
  3. data/.travis.yml +2 -2
  4. data/Gemfile +1 -1
  5. data/README.md +79 -3
  6. data/lib/sorbet-rails.rb +5 -1
  7. data/lib/sorbet-rails/activerecord.rbi +27 -0
  8. data/lib/sorbet-rails/custom_finder_methods.rb +11 -0
  9. data/lib/sorbet-rails/helper_rbi_formatter.rb +33 -0
  10. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +91 -0
  11. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +111 -0
  12. data/lib/sorbet-rails/model_plugins/active_record_enum.rb +43 -0
  13. data/lib/sorbet-rails/model_plugins/active_record_finder_methods.rb +80 -0
  14. data/lib/sorbet-rails/model_plugins/active_record_named_scope.rb +28 -0
  15. data/lib/sorbet-rails/model_plugins/active_record_querying.rb +42 -0
  16. data/lib/sorbet-rails/model_plugins/active_relation_where_not.rb +28 -0
  17. data/lib/sorbet-rails/model_plugins/base.rb +33 -0
  18. data/lib/sorbet-rails/model_plugins/custom_finder_methods.rb +54 -0
  19. data/lib/sorbet-rails/model_plugins/enumerable_collections.rb +49 -0
  20. data/lib/sorbet-rails/model_plugins/plugins.rb +45 -0
  21. data/lib/sorbet-rails/model_rbi_formatter.rb +108 -362
  22. data/lib/sorbet-rails/model_utils.rb +45 -0
  23. data/lib/sorbet-rails/railtie.rb +1 -0
  24. data/lib/sorbet-rails/routes_rbi_formatter.rb +12 -3
  25. data/lib/sorbet-rails/tasks/rails_rbi.rake +36 -15
  26. data/lib/sorbet-rails/utils.rb +4 -0
  27. data/sorbet-rails.gemspec +4 -2
  28. data/spec/helper_rbi_formatter_spec.rb +13 -0
  29. data/spec/model_plugins_spec.rb +31 -0
  30. data/spec/model_rbi_formatter_spec.rb +5 -5
  31. data/spec/rake_rails_rbi_helpers_spec.rb +14 -0
  32. data/spec/routes_rbi_formatter_spec.rb +3 -3
  33. data/spec/sorbet_spec.rb +12 -16
  34. data/spec/support/rails_shared/app/controllers/application_controller.rb +1 -1
  35. data/spec/support/rails_shared/app/helpers/bar_helper.rb +2 -0
  36. data/spec/support/rails_shared/app/helpers/baz_helper.rb +2 -0
  37. data/spec/support/rails_shared/app/helpers/foo_helper.rb +2 -0
  38. data/spec/support/rails_shared/app/models/concerns/mythical.rb +10 -0
  39. data/spec/support/rails_shared/app/models/wand.rb +1 -0
  40. data/spec/support/rails_shared/config/initializers/sorbet_rails.rb +3 -0
  41. data/spec/support/rails_shared/lib/mythical_rbi_plugin.rb +16 -0
  42. data/spec/support/rails_shared/sorbet_test_cases.rb +5 -2
  43. data/spec/support/rails_shared/typed-override.yaml +2 -0
  44. data/spec/support/rails_symlinks/app/helpers +1 -0
  45. data/spec/support/rails_symlinks/config/initializers/sorbet_rails.rb +1 -0
  46. data/spec/support/rails_symlinks/lib/mythical_rbi_plugin.rb +1 -0
  47. data/spec/support/rails_symlinks/typed-override.yaml +1 -0
  48. data/spec/support/v4.2/Gemfile.lock +5 -0
  49. data/spec/support/v4.2/app/helpers +1 -0
  50. data/spec/support/v4.2/config/initializers/sorbet_rails.rb +1 -0
  51. data/spec/support/v4.2/config/routes.rb +0 -1
  52. data/spec/support/v4.2/lib/mythical_rbi_plugin.rb +1 -0
  53. data/spec/support/v4.2/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1 -1
  54. data/spec/support/v4.2/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1 -1
  55. data/spec/support/v4.2/typed-override.yaml +1 -0
  56. data/spec/support/v5.0/Gemfile.lock +5 -0
  57. data/spec/support/v5.0/app/helpers +1 -0
  58. data/spec/support/v5.0/config/initializers/sorbet_rails.rb +1 -0
  59. data/spec/support/v5.0/config/routes.rb +0 -1
  60. data/spec/support/v5.0/lib/mythical_rbi_plugin.rb +1 -0
  61. data/spec/support/v5.0/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1 -1
  62. data/spec/support/v5.0/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1 -1
  63. data/spec/support/v5.0/typed-override.yaml +1 -0
  64. data/spec/support/v5.1/Gemfile.lock +5 -0
  65. data/spec/support/v5.1/app/helpers +1 -0
  66. data/spec/support/v5.1/config/initializers/sorbet_rails.rb +1 -0
  67. data/spec/support/v5.1/lib/mythical_rbi_plugin.rb +1 -0
  68. data/spec/support/v5.1/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1 -1
  69. data/spec/support/v5.1/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1 -1
  70. data/spec/support/v5.1/typed-override.yaml +1 -0
  71. data/spec/support/v5.2-no-sorbet/Gemfile +0 -2
  72. data/spec/support/v5.2-no-sorbet/Gemfile.lock +7 -5
  73. data/spec/support/v5.2-no-sorbet/app/helpers +1 -0
  74. data/spec/support/v5.2-no-sorbet/config/initializers/sorbet_rails.rb +1 -0
  75. data/spec/support/v5.2-no-sorbet/lib/mythical_rbi_plugin.rb +1 -0
  76. data/spec/support/v5.2-no-sorbet/sorbet_test_cases.rb +1 -0
  77. data/spec/support/v5.2-no-sorbet/typed-override.yaml +1 -0
  78. data/spec/support/v5.2/Gemfile +0 -2
  79. data/spec/support/v5.2/Gemfile.lock +7 -5
  80. data/spec/support/v5.2/app/helpers +1 -0
  81. data/spec/support/v5.2/config/initializers/sorbet_rails.rb +1 -0
  82. data/spec/support/v5.2/lib/mythical_rbi_plugin.rb +1 -0
  83. data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1 -1
  84. data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1 -1
  85. data/spec/support/v5.2/typed-override.yaml +1 -0
  86. data/spec/support/v6.0/Gemfile +1 -3
  87. data/spec/support/v6.0/Gemfile.lock +61 -59
  88. data/spec/support/v6.0/app/helpers +1 -0
  89. data/spec/support/v6.0/config/initializers/sorbet_rails.rb +1 -0
  90. data/spec/support/v6.0/config/routes.rb +0 -1
  91. data/spec/support/v6.0/lib/mythical_rbi_plugin.rb +1 -0
  92. data/spec/support/v6.0/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1 -1
  93. data/spec/support/v6.0/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1 -1
  94. data/spec/support/v6.0/typed-override.yaml +1 -0
  95. data/spec/test_data/v4.2/expected_helpers.rbi +17 -0
  96. data/spec/test_data/v4.2/expected_potion.rbi +259 -28
  97. data/spec/test_data/v4.2/expected_spell_book.rbi +278 -37
  98. data/spec/test_data/v4.2/expected_srb_tc_output.txt +1 -99
  99. data/spec/test_data/v4.2/expected_wand.rbi +345 -96
  100. data/spec/test_data/v4.2/expected_wizard.rbi +322 -76
  101. data/spec/test_data/v4.2/expected_wizard_wo_spellbook.rbi +322 -76
  102. data/spec/test_data/v5.0/expected_helpers.rbi +17 -0
  103. data/spec/test_data/v5.0/expected_internal_metadata.rbi +273 -37
  104. data/spec/test_data/v5.0/expected_potion.rbi +259 -28
  105. data/spec/test_data/v5.0/expected_schema_migration.rbi +264 -28
  106. data/spec/test_data/v5.0/expected_spell_book.rbi +278 -37
  107. data/spec/test_data/v5.0/expected_srb_tc_output.txt +1 -81
  108. data/spec/test_data/v5.0/expected_wand.rbi +341 -92
  109. data/spec/test_data/v5.0/expected_wizard.rbi +318 -72
  110. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +318 -72
  111. data/spec/test_data/v5.1/expected_helpers.rbi +17 -0
  112. data/spec/test_data/v5.1/expected_internal_metadata.rbi +273 -37
  113. data/spec/test_data/v5.1/expected_potion.rbi +259 -28
  114. data/spec/test_data/v5.1/expected_schema_migration.rbi +264 -28
  115. data/spec/test_data/v5.1/expected_spell_book.rbi +278 -37
  116. data/spec/test_data/v5.1/expected_srb_tc_output.txt +1 -81
  117. data/spec/test_data/v5.1/expected_wand.rbi +341 -92
  118. data/spec/test_data/v5.1/expected_wizard.rbi +318 -72
  119. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +318 -72
  120. data/spec/test_data/v5.2-no-sorbet/expected_attachment.rbi +265 -29
  121. data/spec/test_data/v5.2-no-sorbet/expected_blob.rbi +271 -35
  122. data/spec/test_data/v5.2-no-sorbet/expected_helpers.rbi +17 -0
  123. data/spec/test_data/v5.2-no-sorbet/expected_internal_metadata.rbi +273 -37
  124. data/spec/test_data/v5.2-no-sorbet/expected_potion.rbi +259 -28
  125. data/spec/test_data/v5.2-no-sorbet/expected_schema_migration.rbi +264 -28
  126. data/spec/test_data/v5.2-no-sorbet/expected_spell_book.rbi +278 -37
  127. data/spec/test_data/v5.2-no-sorbet/expected_srb_tc_output.txt +1 -81
  128. data/spec/test_data/v5.2-no-sorbet/expected_wand.rbi +351 -102
  129. data/spec/test_data/v5.2-no-sorbet/expected_wizard.rbi +318 -72
  130. data/spec/test_data/v5.2-no-sorbet/expected_wizard_wo_spellbook.rbi +318 -72
  131. data/spec/test_data/v5.2/expected_attachment.rbi +265 -29
  132. data/spec/test_data/v5.2/expected_blob.rbi +271 -35
  133. data/spec/test_data/v5.2/expected_helpers.rbi +17 -0
  134. data/spec/test_data/v5.2/expected_internal_metadata.rbi +273 -37
  135. data/spec/test_data/v5.2/expected_potion.rbi +259 -28
  136. data/spec/test_data/v5.2/expected_schema_migration.rbi +264 -28
  137. data/spec/test_data/v5.2/expected_spell_book.rbi +278 -37
  138. data/spec/test_data/v5.2/expected_srb_tc_output.txt +1 -81
  139. data/spec/test_data/v5.2/expected_wand.rbi +351 -102
  140. data/spec/test_data/v5.2/expected_wizard.rbi +318 -72
  141. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +318 -72
  142. data/spec/test_data/v6.0/expected_attachment.rbi +265 -29
  143. data/spec/test_data/v6.0/expected_blob.rbi +271 -35
  144. data/spec/test_data/v6.0/expected_helpers.rbi +17 -0
  145. data/spec/test_data/v6.0/expected_internal_metadata.rbi +273 -37
  146. data/spec/test_data/v6.0/expected_potion.rbi +259 -28
  147. data/spec/test_data/v6.0/expected_schema_migration.rbi +264 -28
  148. data/spec/test_data/v6.0/expected_spell_book.rbi +278 -37
  149. data/spec/test_data/v6.0/expected_srb_tc_output.txt +1 -81
  150. data/spec/test_data/v6.0/expected_wand.rbi +351 -102
  151. data/spec/test_data/v6.0/expected_wizard.rbi +318 -72
  152. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +318 -72
  153. metadata +120 -37
  154. data/lib/sorbet-rails/rbi/activerecord.rbi +0 -207
  155. data/spec/support/v4.2/app/helpers/application_helper.rb +0 -3
  156. data/spec/support/v4.2/sorbet/rbi/gems/sorbet-runtime.rbi +0 -647
  157. data/spec/support/v4.2/sorbet/rbi/hidden-definitions/errors.txt +0 -11998
  158. data/spec/support/v4.2/sorbet/rbi/hidden-definitions/hidden.rbi +0 -27774
  159. data/spec/support/v5.0/sorbet/rbi/gems/sorbet-runtime.rbi +0 -647
  160. data/spec/support/v5.0/sorbet/rbi/hidden-definitions/errors.txt +0 -10523
  161. data/spec/support/v5.0/sorbet/rbi/hidden-definitions/hidden.rbi +0 -24969
  162. data/spec/support/v5.1/sorbet/rbi/gems/sorbet-runtime.rbi +0 -647
  163. data/spec/support/v5.1/sorbet/rbi/hidden-definitions/errors.txt +0 -10226
  164. data/spec/support/v5.1/sorbet/rbi/hidden-definitions/hidden.rbi +0 -24635
  165. data/spec/support/v5.2/.ruby-version +0 -1
  166. data/spec/support/v5.2/sorbet/rbi/gems/sorbet-runtime.rbi +0 -644
  167. data/spec/support/v5.2/sorbet/rbi/hidden-definitions/errors.txt +0 -10046
  168. data/spec/support/v5.2/sorbet/rbi/hidden-definitions/hidden.rbi +0 -24424
  169. data/spec/support/v6.0/sorbet/rbi/gems/sorbet-runtime.rbi +0 -647
  170. data/spec/support/v6.0/sorbet/rbi/hidden-definitions/errors.txt +0 -12074
  171. data/spec/support/v6.0/sorbet/rbi/hidden-definitions/hidden.rbi +0 -28231
@@ -1,51 +1,47 @@
1
1
  # This is an autogenerated file for dynamic methods in ActiveRecord::SchemaMigration
2
- # Please rerun rake rails_rbi:models to regenerate.
3
- # typed: strong
4
-
5
- class ActiveRecord::SchemaMigration::ActiveRecord_Relation < ActiveRecord::Relation
6
- include ActiveRecord::SchemaMigration::ModelRelationShared
7
- extend T::Generic
8
- Elem = type_member(fixed: ActiveRecord::SchemaMigration)
9
- end
10
-
11
- class ActiveRecord::SchemaMigration::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
12
- include ActiveRecord::SchemaMigration::ModelRelationShared
13
- extend T::Generic
14
- Elem = type_member(fixed: ActiveRecord::SchemaMigration)
15
- end
2
+ # Please rerun rake rails_rbi:models[ActiveRecord::SchemaMigration] to regenerate.
16
3
 
17
- class ActiveRecord::SchemaMigration < ActiveRecord::Base
18
- extend T::Sig
19
- extend T::Generic
20
- extend ActiveRecord::SchemaMigration::ModelRelationShared
21
- include ActiveRecord::SchemaMigration::InstanceMethods
22
- Elem = type_template(fixed: ActiveRecord::SchemaMigration)
4
+ # typed: strong
5
+ module ActiveRecord::SchemaMigration::ActiveRelation_WhereNot
6
+ sig { params(opts: T.untyped, rest: T.untyped).returns(T.self_type) }
7
+ def not(opts, *rest); end
23
8
  end
24
9
 
25
- module ActiveRecord::SchemaMigration::InstanceMethods
10
+ module ActiveRecord::SchemaMigration::GeneratedAttributeMethods
26
11
  extend T::Sig
27
12
 
28
13
  sig { returns(String) }
29
- def version(); end
14
+ def version; end
30
15
 
31
16
  sig { params(value: String).void }
32
17
  def version=(value); end
33
18
 
34
- sig { params(args: T.untyped).returns(T::Boolean) }
35
- def version?(*args); end
36
-
19
+ sig { returns(T::Boolean) }
20
+ def version?; end
37
21
  end
38
22
 
39
- class ActiveRecord::SchemaMigration
40
- extend T::Sig
23
+ module ActiveRecord::SchemaMigration::CustomFinderMethods
24
+ sig { params(limit: Integer).returns(T::Array[ActiveRecord::SchemaMigration]) }
25
+ def first_n(limit); end
26
+
27
+ sig { params(limit: Integer).returns(T::Array[ActiveRecord::SchemaMigration]) }
28
+ def last_n(limit); end
29
+
30
+ sig { params(args: T::Array[T.any(Integer, String)]).returns(T::Array[ActiveRecord::SchemaMigration]) }
31
+ def find_n(*args); end
32
+
33
+ sig { params(id: Integer).returns(T.nilable(ActiveRecord::SchemaMigration)) }
34
+ def find_by_id(id); end
41
35
 
36
+ sig { params(id: Integer).returns(ActiveRecord::SchemaMigration) }
37
+ def find_by_id!(id); end
42
38
  end
43
39
 
44
40
  module ActiveRecord::SchemaMigration::ModelRelationShared
45
41
  extend T::Sig
46
42
 
47
43
  sig { returns(ActiveRecord::SchemaMigration::ActiveRecord_Relation) }
48
- def all(); end
44
+ def all; end
49
45
 
50
46
  sig { params(block: T.nilable(T.proc.void)).returns(ActiveRecord::SchemaMigration::ActiveRecord_Relation) }
51
47
  def unscoped(&block); end
@@ -142,5 +138,245 @@ module ActiveRecord::SchemaMigration::ModelRelationShared
142
138
 
143
139
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(ActiveRecord::SchemaMigration::ActiveRecord_Relation) }
144
140
  def only(*args, &block); end
141
+ end
142
+
143
+ class ActiveRecord::SchemaMigration::ActiveRecord_Relation < ActiveRecord::Relation
144
+ include ActiveRecord::SchemaMigration::ActiveRelation_WhereNot
145
+ include SorbetRails::CustomFinderMethods
146
+ include ActiveRecord::SchemaMigration::CustomFinderMethods
147
+ include Enumerable
148
+ include ActiveRecord::SchemaMigration::ModelRelationShared
149
+ extend T::Sig
150
+ extend T::Generic
151
+ Elem = type_member(fixed: ActiveRecord::SchemaMigration)
152
+
153
+ sig { params(args: T.untyped).returns(ActiveRecord::SchemaMigration) }
154
+ def find(*args); end
145
155
 
156
+ sig { params(args: T.untyped).returns(T.nilable(ActiveRecord::SchemaMigration)) }
157
+ def find_by(*args); end
158
+
159
+ sig { params(args: T.untyped).returns(ActiveRecord::SchemaMigration) }
160
+ def find_by!(*args); end
161
+
162
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
163
+ def first; end
164
+
165
+ sig { returns(ActiveRecord::SchemaMigration) }
166
+ def first!; end
167
+
168
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
169
+ def second; end
170
+
171
+ sig { returns(ActiveRecord::SchemaMigration) }
172
+ def second!; end
173
+
174
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
175
+ def third; end
176
+
177
+ sig { returns(ActiveRecord::SchemaMigration) }
178
+ def third!; end
179
+
180
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
181
+ def third_to_last; end
182
+
183
+ sig { returns(ActiveRecord::SchemaMigration) }
184
+ def third_to_last!; end
185
+
186
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
187
+ def second_to_last; end
188
+
189
+ sig { returns(ActiveRecord::SchemaMigration) }
190
+ def second_to_last!; end
191
+
192
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
193
+ def last; end
194
+
195
+ sig { returns(ActiveRecord::SchemaMigration) }
196
+ def last!; end
197
+
198
+ sig { params(conditions: T.untyped).returns(T::Boolean) }
199
+ def exists?(conditions = nil); end
200
+
201
+ sig { params(args: T.untyped).returns(T::Boolean) }
202
+ def any?(*args); end
203
+
204
+ sig { params(args: T.untyped).returns(T::Boolean) }
205
+ def many?(*args); end
206
+
207
+ sig { params(args: T.untyped).returns(T::Boolean) }
208
+ def none?(*args); end
209
+
210
+ sig { params(args: T.untyped).returns(T::Boolean) }
211
+ def one?(*args); end
212
+
213
+ sig { implementation.params(block: T.proc.params(e: ActiveRecord::SchemaMigration).void).void }
214
+ def each(&block); end
215
+
216
+ sig { params(level: T.nilable(Integer)).returns(T::Array[ActiveRecord::SchemaMigration]) }
217
+ def flatten(level); end
218
+
219
+ sig { returns(T::Array[ActiveRecord::SchemaMigration]) }
220
+ def to_a; end
221
+ end
222
+
223
+ class ActiveRecord::SchemaMigration::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
224
+ include ActiveRecord::SchemaMigration::ActiveRelation_WhereNot
225
+ include SorbetRails::CustomFinderMethods
226
+ include ActiveRecord::SchemaMigration::CustomFinderMethods
227
+ include Enumerable
228
+ include ActiveRecord::SchemaMigration::ModelRelationShared
229
+ extend T::Sig
230
+ extend T::Generic
231
+ Elem = type_member(fixed: ActiveRecord::SchemaMigration)
232
+
233
+ sig { params(args: T.untyped).returns(ActiveRecord::SchemaMigration) }
234
+ def find(*args); end
235
+
236
+ sig { params(args: T.untyped).returns(T.nilable(ActiveRecord::SchemaMigration)) }
237
+ def find_by(*args); end
238
+
239
+ sig { params(args: T.untyped).returns(ActiveRecord::SchemaMigration) }
240
+ def find_by!(*args); end
241
+
242
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
243
+ def first; end
244
+
245
+ sig { returns(ActiveRecord::SchemaMigration) }
246
+ def first!; end
247
+
248
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
249
+ def second; end
250
+
251
+ sig { returns(ActiveRecord::SchemaMigration) }
252
+ def second!; end
253
+
254
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
255
+ def third; end
256
+
257
+ sig { returns(ActiveRecord::SchemaMigration) }
258
+ def third!; end
259
+
260
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
261
+ def third_to_last; end
262
+
263
+ sig { returns(ActiveRecord::SchemaMigration) }
264
+ def third_to_last!; end
265
+
266
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
267
+ def second_to_last; end
268
+
269
+ sig { returns(ActiveRecord::SchemaMigration) }
270
+ def second_to_last!; end
271
+
272
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
273
+ def last; end
274
+
275
+ sig { returns(ActiveRecord::SchemaMigration) }
276
+ def last!; end
277
+
278
+ sig { params(conditions: T.untyped).returns(T::Boolean) }
279
+ def exists?(conditions = nil); end
280
+
281
+ sig { params(args: T.untyped).returns(T::Boolean) }
282
+ def any?(*args); end
283
+
284
+ sig { params(args: T.untyped).returns(T::Boolean) }
285
+ def many?(*args); end
286
+
287
+ sig { params(args: T.untyped).returns(T::Boolean) }
288
+ def none?(*args); end
289
+
290
+ sig { params(args: T.untyped).returns(T::Boolean) }
291
+ def one?(*args); end
292
+
293
+ sig { implementation.params(block: T.proc.params(e: ActiveRecord::SchemaMigration).void).void }
294
+ def each(&block); end
295
+
296
+ sig { params(level: T.nilable(Integer)).returns(T::Array[ActiveRecord::SchemaMigration]) }
297
+ def flatten(level); end
298
+
299
+ sig { returns(T::Array[ActiveRecord::SchemaMigration]) }
300
+ def to_a; end
301
+
302
+ sig { params(records: T.any(ActiveRecord::SchemaMigration, T::Array[ActiveRecord::SchemaMigration])).returns(T.self_type) }
303
+ def <<(*records); end
304
+
305
+ sig { params(records: T.any(ActiveRecord::SchemaMigration, T::Array[ActiveRecord::SchemaMigration])).returns(T.self_type) }
306
+ def append(*records); end
307
+
308
+ sig { params(records: T.any(ActiveRecord::SchemaMigration, T::Array[ActiveRecord::SchemaMigration])).returns(T.self_type) }
309
+ def push(*records); end
310
+
311
+ sig { params(records: T.any(ActiveRecord::SchemaMigration, T::Array[ActiveRecord::SchemaMigration])).returns(T.self_type) }
312
+ def concat(*records); end
313
+ end
314
+
315
+ class ActiveRecord::SchemaMigration < ActiveRecord::Base
316
+ include ActiveRecord::SchemaMigration::GeneratedAttributeMethods
317
+ extend SorbetRails::CustomFinderMethods
318
+ extend ActiveRecord::SchemaMigration::CustomFinderMethods
319
+ extend T::Sig
320
+ extend T::Generic
321
+ extend ActiveRecord::SchemaMigration::ModelRelationShared
322
+
323
+ sig { params(args: T.untyped).returns(ActiveRecord::SchemaMigration) }
324
+ def self.find(*args); end
325
+
326
+ sig { params(args: T.untyped).returns(T.nilable(ActiveRecord::SchemaMigration)) }
327
+ def self.find_by(*args); end
328
+
329
+ sig { params(args: T.untyped).returns(ActiveRecord::SchemaMigration) }
330
+ def self.find_by!(*args); end
331
+
332
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
333
+ def self.first; end
334
+
335
+ sig { returns(ActiveRecord::SchemaMigration) }
336
+ def self.first!; end
337
+
338
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
339
+ def self.second; end
340
+
341
+ sig { returns(ActiveRecord::SchemaMigration) }
342
+ def self.second!; end
343
+
344
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
345
+ def self.third; end
346
+
347
+ sig { returns(ActiveRecord::SchemaMigration) }
348
+ def self.third!; end
349
+
350
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
351
+ def self.third_to_last; end
352
+
353
+ sig { returns(ActiveRecord::SchemaMigration) }
354
+ def self.third_to_last!; end
355
+
356
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
357
+ def self.second_to_last; end
358
+
359
+ sig { returns(ActiveRecord::SchemaMigration) }
360
+ def self.second_to_last!; end
361
+
362
+ sig { returns(T.nilable(ActiveRecord::SchemaMigration)) }
363
+ def self.last; end
364
+
365
+ sig { returns(ActiveRecord::SchemaMigration) }
366
+ def self.last!; end
367
+
368
+ sig { params(conditions: T.untyped).returns(T::Boolean) }
369
+ def self.exists?(conditions = nil); end
370
+
371
+ sig { params(args: T.untyped).returns(T::Boolean) }
372
+ def self.any?(*args); end
373
+
374
+ sig { params(args: T.untyped).returns(T::Boolean) }
375
+ def self.many?(*args); end
376
+
377
+ sig { params(args: T.untyped).returns(T::Boolean) }
378
+ def self.none?(*args); end
379
+
380
+ sig { params(args: T.untyped).returns(T::Boolean) }
381
+ def self.one?(*args); end
146
382
  end
@@ -1,82 +1,82 @@
1
1
  # This is an autogenerated file for dynamic methods in SpellBook
2
- # Please rerun rake rails_rbi:models to regenerate.
3
- # typed: strong
2
+ # Please rerun rake rails_rbi:models[SpellBook] to regenerate.
4
3
 
5
- class SpellBook::ActiveRecord_Relation < ActiveRecord::Relation
6
- include SpellBook::ModelRelationShared
7
- extend T::Generic
8
- Elem = type_member(fixed: SpellBook)
9
- end
10
-
11
- class SpellBook::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
12
- include SpellBook::ModelRelationShared
13
- extend T::Generic
14
- Elem = type_member(fixed: SpellBook)
15
- end
16
-
17
- class SpellBook < ApplicationRecord
18
- extend T::Sig
19
- extend T::Generic
20
- extend SpellBook::ModelRelationShared
21
- include SpellBook::InstanceMethods
22
- Elem = type_template(fixed: SpellBook)
4
+ # typed: strong
5
+ module SpellBook::ActiveRelation_WhereNot
6
+ sig { params(opts: T.untyped, rest: T.untyped).returns(T.self_type) }
7
+ def not(opts, *rest); end
23
8
  end
24
9
 
25
- module SpellBook::InstanceMethods
10
+ module SpellBook::GeneratedAttributeMethods
26
11
  extend T::Sig
27
12
 
28
13
  sig { returns(Integer) }
29
- def id(); end
14
+ def id; end
30
15
 
31
16
  sig { params(value: Integer).void }
32
17
  def id=(value); end
33
18
 
34
- sig { params(args: T.untyped).returns(T::Boolean) }
35
- def id?(*args); end
19
+ sig { returns(T::Boolean) }
20
+ def id?; end
36
21
 
37
22
  sig { returns(T.nilable(String)) }
38
- def name(); end
23
+ def name; end
39
24
 
40
25
  sig { params(value: T.nilable(String)).void }
41
26
  def name=(value); end
42
27
 
43
- sig { params(args: T.untyped).returns(T::Boolean) }
44
- def name?(*args); end
28
+ sig { returns(T::Boolean) }
29
+ def name?; end
45
30
 
46
31
  sig { returns(T.nilable(Integer)) }
47
- def wizard_id(); end
32
+ def wizard_id; end
48
33
 
49
34
  sig { params(value: T.nilable(Integer)).void }
50
35
  def wizard_id=(value); end
51
36
 
52
- sig { params(args: T.untyped).returns(T::Boolean) }
53
- def wizard_id?(*args); end
54
-
37
+ sig { returns(T::Boolean) }
38
+ def wizard_id?; end
55
39
  end
56
40
 
57
- class SpellBook
41
+ module SpellBook::GeneratedAssociationMethods
58
42
  extend T::Sig
59
43
 
60
44
  sig { returns(T.nilable(::Wizard)) }
61
- def wizard(); end
45
+ def wizard; end
62
46
 
63
47
  sig { params(value: T.nilable(::Wizard)).void }
64
48
  def wizard=(value); end
49
+ end
50
+
51
+ module SpellBook::CustomFinderMethods
52
+ sig { params(limit: Integer).returns(T::Array[SpellBook]) }
53
+ def first_n(limit); end
54
+
55
+ sig { params(limit: Integer).returns(T::Array[SpellBook]) }
56
+ def last_n(limit); end
57
+
58
+ sig { params(args: T::Array[T.any(Integer, String)]).returns(T::Array[SpellBook]) }
59
+ def find_n(*args); end
65
60
 
61
+ sig { params(id: Integer).returns(T.nilable(SpellBook)) }
62
+ def find_by_id(id); end
63
+
64
+ sig { params(id: Integer).returns(SpellBook) }
65
+ def find_by_id!(id); end
66
66
  end
67
67
 
68
68
  module SpellBook::ModelRelationShared
69
69
  extend T::Sig
70
70
 
71
+ sig { params(args: T.untyped).returns(SpellBook::ActiveRecord_Relation) }
72
+ def recent(*args); end
73
+
71
74
  sig { returns(SpellBook::ActiveRecord_Relation) }
72
- def all(); end
75
+ def all; end
73
76
 
74
77
  sig { params(block: T.nilable(T.proc.void)).returns(SpellBook::ActiveRecord_Relation) }
75
78
  def unscoped(&block); end
76
79
 
77
- sig { params(args: T.untyped).returns(SpellBook::ActiveRecord_Relation) }
78
- def recent(*args); end
79
-
80
80
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(SpellBook::ActiveRecord_Relation) }
81
81
  def select(*args, &block); end
82
82
 
@@ -169,5 +169,246 @@ module SpellBook::ModelRelationShared
169
169
 
170
170
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(SpellBook::ActiveRecord_Relation) }
171
171
  def only(*args, &block); end
172
+ end
173
+
174
+ class SpellBook::ActiveRecord_Relation < ActiveRecord::Relation
175
+ include SpellBook::ActiveRelation_WhereNot
176
+ include SorbetRails::CustomFinderMethods
177
+ include SpellBook::CustomFinderMethods
178
+ include Enumerable
179
+ include SpellBook::ModelRelationShared
180
+ extend T::Sig
181
+ extend T::Generic
182
+ Elem = type_member(fixed: SpellBook)
183
+
184
+ sig { params(args: T.untyped).returns(SpellBook) }
185
+ def find(*args); end
186
+
187
+ sig { params(args: T.untyped).returns(T.nilable(SpellBook)) }
188
+ def find_by(*args); end
189
+
190
+ sig { params(args: T.untyped).returns(SpellBook) }
191
+ def find_by!(*args); end
192
+
193
+ sig { returns(T.nilable(SpellBook)) }
194
+ def first; end
195
+
196
+ sig { returns(SpellBook) }
197
+ def first!; end
198
+
199
+ sig { returns(T.nilable(SpellBook)) }
200
+ def second; end
201
+
202
+ sig { returns(SpellBook) }
203
+ def second!; end
204
+
205
+ sig { returns(T.nilable(SpellBook)) }
206
+ def third; end
207
+
208
+ sig { returns(SpellBook) }
209
+ def third!; end
210
+
211
+ sig { returns(T.nilable(SpellBook)) }
212
+ def third_to_last; end
213
+
214
+ sig { returns(SpellBook) }
215
+ def third_to_last!; end
216
+
217
+ sig { returns(T.nilable(SpellBook)) }
218
+ def second_to_last; end
219
+
220
+ sig { returns(SpellBook) }
221
+ def second_to_last!; end
222
+
223
+ sig { returns(T.nilable(SpellBook)) }
224
+ def last; end
225
+
226
+ sig { returns(SpellBook) }
227
+ def last!; end
228
+
229
+ sig { params(conditions: T.untyped).returns(T::Boolean) }
230
+ def exists?(conditions = nil); end
231
+
232
+ sig { params(args: T.untyped).returns(T::Boolean) }
233
+ def any?(*args); end
234
+
235
+ sig { params(args: T.untyped).returns(T::Boolean) }
236
+ def many?(*args); end
237
+
238
+ sig { params(args: T.untyped).returns(T::Boolean) }
239
+ def none?(*args); end
240
+
241
+ sig { params(args: T.untyped).returns(T::Boolean) }
242
+ def one?(*args); end
243
+
244
+ sig { implementation.params(block: T.proc.params(e: SpellBook).void).void }
245
+ def each(&block); end
246
+
247
+ sig { params(level: T.nilable(Integer)).returns(T::Array[SpellBook]) }
248
+ def flatten(level); end
249
+
250
+ sig { returns(T::Array[SpellBook]) }
251
+ def to_a; end
252
+ end
253
+
254
+ class SpellBook::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
255
+ include SpellBook::ActiveRelation_WhereNot
256
+ include SorbetRails::CustomFinderMethods
257
+ include SpellBook::CustomFinderMethods
258
+ include Enumerable
259
+ include SpellBook::ModelRelationShared
260
+ extend T::Sig
261
+ extend T::Generic
262
+ Elem = type_member(fixed: SpellBook)
263
+
264
+ sig { params(args: T.untyped).returns(SpellBook) }
265
+ def find(*args); end
266
+
267
+ sig { params(args: T.untyped).returns(T.nilable(SpellBook)) }
268
+ def find_by(*args); end
269
+
270
+ sig { params(args: T.untyped).returns(SpellBook) }
271
+ def find_by!(*args); end
272
+
273
+ sig { returns(T.nilable(SpellBook)) }
274
+ def first; end
275
+
276
+ sig { returns(SpellBook) }
277
+ def first!; end
278
+
279
+ sig { returns(T.nilable(SpellBook)) }
280
+ def second; end
281
+
282
+ sig { returns(SpellBook) }
283
+ def second!; end
284
+
285
+ sig { returns(T.nilable(SpellBook)) }
286
+ def third; end
287
+
288
+ sig { returns(SpellBook) }
289
+ def third!; end
290
+
291
+ sig { returns(T.nilable(SpellBook)) }
292
+ def third_to_last; end
293
+
294
+ sig { returns(SpellBook) }
295
+ def third_to_last!; end
296
+
297
+ sig { returns(T.nilable(SpellBook)) }
298
+ def second_to_last; end
299
+
300
+ sig { returns(SpellBook) }
301
+ def second_to_last!; end
302
+
303
+ sig { returns(T.nilable(SpellBook)) }
304
+ def last; end
305
+
306
+ sig { returns(SpellBook) }
307
+ def last!; end
308
+
309
+ sig { params(conditions: T.untyped).returns(T::Boolean) }
310
+ def exists?(conditions = nil); end
311
+
312
+ sig { params(args: T.untyped).returns(T::Boolean) }
313
+ def any?(*args); end
314
+
315
+ sig { params(args: T.untyped).returns(T::Boolean) }
316
+ def many?(*args); end
317
+
318
+ sig { params(args: T.untyped).returns(T::Boolean) }
319
+ def none?(*args); end
320
+
321
+ sig { params(args: T.untyped).returns(T::Boolean) }
322
+ def one?(*args); end
323
+
324
+ sig { implementation.params(block: T.proc.params(e: SpellBook).void).void }
325
+ def each(&block); end
326
+
327
+ sig { params(level: T.nilable(Integer)).returns(T::Array[SpellBook]) }
328
+ def flatten(level); end
329
+
330
+ sig { returns(T::Array[SpellBook]) }
331
+ def to_a; end
172
332
 
333
+ sig { params(records: T.any(SpellBook, T::Array[SpellBook])).returns(T.self_type) }
334
+ def <<(*records); end
335
+
336
+ sig { params(records: T.any(SpellBook, T::Array[SpellBook])).returns(T.self_type) }
337
+ def append(*records); end
338
+
339
+ sig { params(records: T.any(SpellBook, T::Array[SpellBook])).returns(T.self_type) }
340
+ def push(*records); end
341
+
342
+ sig { params(records: T.any(SpellBook, T::Array[SpellBook])).returns(T.self_type) }
343
+ def concat(*records); end
344
+ end
345
+
346
+ class SpellBook < ApplicationRecord
347
+ include SpellBook::GeneratedAttributeMethods
348
+ include SpellBook::GeneratedAssociationMethods
349
+ extend SorbetRails::CustomFinderMethods
350
+ extend SpellBook::CustomFinderMethods
351
+ extend T::Sig
352
+ extend T::Generic
353
+ extend SpellBook::ModelRelationShared
354
+
355
+ sig { params(args: T.untyped).returns(SpellBook) }
356
+ def self.find(*args); end
357
+
358
+ sig { params(args: T.untyped).returns(T.nilable(SpellBook)) }
359
+ def self.find_by(*args); end
360
+
361
+ sig { params(args: T.untyped).returns(SpellBook) }
362
+ def self.find_by!(*args); end
363
+
364
+ sig { returns(T.nilable(SpellBook)) }
365
+ def self.first; end
366
+
367
+ sig { returns(SpellBook) }
368
+ def self.first!; end
369
+
370
+ sig { returns(T.nilable(SpellBook)) }
371
+ def self.second; end
372
+
373
+ sig { returns(SpellBook) }
374
+ def self.second!; end
375
+
376
+ sig { returns(T.nilable(SpellBook)) }
377
+ def self.third; end
378
+
379
+ sig { returns(SpellBook) }
380
+ def self.third!; end
381
+
382
+ sig { returns(T.nilable(SpellBook)) }
383
+ def self.third_to_last; end
384
+
385
+ sig { returns(SpellBook) }
386
+ def self.third_to_last!; end
387
+
388
+ sig { returns(T.nilable(SpellBook)) }
389
+ def self.second_to_last; end
390
+
391
+ sig { returns(SpellBook) }
392
+ def self.second_to_last!; end
393
+
394
+ sig { returns(T.nilable(SpellBook)) }
395
+ def self.last; end
396
+
397
+ sig { returns(SpellBook) }
398
+ def self.last!; end
399
+
400
+ sig { params(conditions: T.untyped).returns(T::Boolean) }
401
+ def self.exists?(conditions = nil); end
402
+
403
+ sig { params(args: T.untyped).returns(T::Boolean) }
404
+ def self.any?(*args); end
405
+
406
+ sig { params(args: T.untyped).returns(T::Boolean) }
407
+ def self.many?(*args); end
408
+
409
+ sig { params(args: T.untyped).returns(T::Boolean) }
410
+ def self.none?(*args); end
411
+
412
+ sig { params(args: T.untyped).returns(T::Boolean) }
413
+ def self.one?(*args); end
173
414
  end