sorbet-rails 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sorbet-rails/active_record_rbi_formatter.rb +295 -0
  3. data/lib/sorbet-rails/config.rb +0 -1
  4. data/lib/sorbet-rails/custom_types/boolean_string.rb +10 -0
  5. data/lib/sorbet-rails/custom_types/integer_string.rb +10 -0
  6. data/lib/sorbet-rails/dependent_gem_rbis/activerecord.rbi +11 -0
  7. data/lib/sorbet-rails/deprecation.rb +5 -0
  8. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +27 -6
  9. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +20 -8
  10. data/lib/sorbet-rails/model_plugins/base.rb +9 -0
  11. data/lib/sorbet-rails/model_plugins/enumerable_collections.rb +0 -50
  12. data/lib/sorbet-rails/model_plugins/plugins.rb +0 -3
  13. data/lib/sorbet-rails/model_rbi_formatter.rb +2 -2
  14. data/lib/sorbet-rails/model_utils.rb +15 -6
  15. data/lib/sorbet-rails/rails_mixins/custom_params_methods.rb +11 -0
  16. data/lib/sorbet-rails/tasks/rails_rbi.rake +20 -4
  17. data/sorbet-rails.gemspec +2 -2
  18. data/spec/active_record_rbi_formatter_spec.rb +24 -0
  19. data/spec/generators/rails-template.rb +88 -1
  20. data/spec/generators/sorbet_test_cases.rb +146 -42
  21. data/spec/model_rbi_formatter_spec.rb +1 -1
  22. data/spec/rails_helper.rb +14 -1
  23. data/spec/rake_rails_rbi_active_record_spec.rb +21 -0
  24. data/spec/rake_rails_rbi_models_spec.rb +7 -0
  25. data/spec/sorbet_spec.rb +12 -1
  26. data/spec/support/v5.0/Gemfile.lock +8 -8
  27. data/spec/support/v5.0/app/models/headmaster.rb +8 -0
  28. data/spec/support/v5.0/app/models/school.rb +2 -0
  29. data/spec/support/v5.0/app/models/spell.rb +5 -0
  30. data/spec/support/v5.0/app/models/spell_book.rb +3 -0
  31. data/spec/support/v5.0/app/models/subject.rb +5 -0
  32. data/spec/support/v5.0/app/models/wizard.rb +6 -1
  33. data/spec/support/v5.0/db/migrate/20190620000010_add_subject.rb +8 -0
  34. data/spec/support/v5.0/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
  35. data/spec/support/v5.0/db/migrate/20190620000012_add_spell.rb +8 -0
  36. data/spec/support/v5.0/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
  37. data/spec/support/v5.0/db/migrate/20190620000014_create_headmasters.rb +9 -0
  38. data/spec/support/v5.0/db/schema.rb +28 -1
  39. data/spec/support/v5.0/lib/mythical_rbi_plugin.rb +1 -1
  40. data/spec/support/v5.0/sorbet_test_cases.rb +146 -42
  41. data/spec/support/v5.1/Gemfile.lock +8 -8
  42. data/spec/support/v5.1/app/models/headmaster.rb +8 -0
  43. data/spec/support/v5.1/app/models/school.rb +2 -0
  44. data/spec/support/v5.1/app/models/spell.rb +5 -0
  45. data/spec/support/v5.1/app/models/spell_book.rb +3 -0
  46. data/spec/support/v5.1/app/models/subject.rb +5 -0
  47. data/spec/support/v5.1/app/models/wizard.rb +6 -1
  48. data/spec/support/v5.1/db/migrate/20190620000010_add_subject.rb +8 -0
  49. data/spec/support/v5.1/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
  50. data/spec/support/v5.1/db/migrate/20190620000012_add_spell.rb +8 -0
  51. data/spec/support/v5.1/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
  52. data/spec/support/v5.1/db/migrate/20190620000014_create_headmasters.rb +9 -0
  53. data/spec/support/v5.1/db/schema.rb +28 -1
  54. data/spec/support/v5.1/lib/mythical_rbi_plugin.rb +1 -1
  55. data/spec/support/v5.1/sorbet_test_cases.rb +146 -42
  56. data/spec/support/v5.2/Gemfile +1 -1
  57. data/spec/support/v5.2/Gemfile.lock +9 -9
  58. data/spec/support/v5.2/app/models/headmaster.rb +8 -0
  59. data/spec/support/v5.2/app/models/school.rb +2 -0
  60. data/spec/support/v5.2/app/models/spell.rb +5 -0
  61. data/spec/support/v5.2/app/models/spell_book.rb +3 -0
  62. data/spec/support/v5.2/app/models/subject.rb +5 -0
  63. data/spec/support/v5.2/app/models/wizard.rb +5 -0
  64. data/spec/support/v5.2/config/puma.rb +3 -0
  65. data/spec/support/v5.2/db/migrate/20190620000010_add_subject.rb +8 -0
  66. data/spec/support/v5.2/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
  67. data/spec/support/v5.2/db/migrate/20190620000012_add_spell.rb +8 -0
  68. data/spec/support/v5.2/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
  69. data/spec/support/v5.2/db/migrate/20190620000014_create_headmasters.rb +9 -0
  70. data/spec/support/v5.2/db/schema.rb +28 -1
  71. data/spec/support/v5.2/lib/mythical_rbi_plugin.rb +1 -1
  72. data/spec/support/v5.2/sorbet_test_cases.rb +146 -42
  73. data/spec/support/v6.0/Gemfile.lock +8 -8
  74. data/spec/support/v6.0/app/models/headmaster.rb +8 -0
  75. data/spec/support/v6.0/app/models/school.rb +2 -0
  76. data/spec/support/v6.0/app/models/spell.rb +5 -0
  77. data/spec/support/v6.0/app/models/spell_book.rb +3 -0
  78. data/spec/support/v6.0/app/models/subject.rb +5 -0
  79. data/spec/support/v6.0/app/models/wizard.rb +6 -1
  80. data/spec/support/v6.0/db/migrate/20190620000010_add_subject.rb +8 -0
  81. data/spec/support/v6.0/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
  82. data/spec/support/v6.0/db/migrate/20190620000012_add_spell.rb +8 -0
  83. data/spec/support/v6.0/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
  84. data/spec/support/v6.0/db/migrate/20190620000014_create_headmasters.rb +9 -0
  85. data/spec/support/v6.0/db/schema.rb +28 -1
  86. data/spec/support/v6.0/lib/mythical_rbi_plugin.rb +1 -1
  87. data/spec/support/v6.0/sorbet_test_cases.rb +146 -42
  88. data/spec/test_data/v5.0/expected_active_record_base.rbi +113 -0
  89. data/spec/test_data/v5.0/expected_active_record_relation.rbi +199 -0
  90. data/spec/test_data/v5.0/expected_habtm_subjects.rbi +660 -0
  91. data/spec/test_data/v5.0/expected_habtm_wizards.rbi +660 -0
  92. data/spec/test_data/v5.0/expected_headmaster.rbi +452 -0
  93. data/spec/test_data/v5.0/expected_internal_metadata.rbi +0 -217
  94. data/spec/test_data/v5.0/expected_potion.rbi +0 -217
  95. data/spec/test_data/v5.0/expected_robe.rbi +0 -217
  96. data/spec/test_data/v5.0/expected_schema_migration.rbi +0 -217
  97. data/spec/test_data/v5.0/expected_school.rbi +11 -217
  98. data/spec/test_data/v5.0/expected_spell.rbi +440 -0
  99. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +443 -0
  100. data/spec/test_data/v5.0/expected_spell_book.rbi +14 -222
  101. data/spec/test_data/v5.0/expected_spell_book/habtm_spell_books.rbi +637 -0
  102. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +443 -0
  103. data/spec/test_data/v5.0/expected_squib.rbi +14 -219
  104. data/spec/test_data/v5.0/expected_subject.rbi +440 -0
  105. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +443 -0
  106. data/spec/test_data/v5.0/expected_wand.rbi +4 -221
  107. data/spec/test_data/v5.0/expected_wizard.rbi +36 -240
  108. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +443 -0
  109. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +30 -240
  110. data/spec/test_data/v5.1/expected_active_record_base.rbi +113 -0
  111. data/spec/test_data/v5.1/expected_active_record_relation.rbi +178 -0
  112. data/spec/test_data/v5.1/expected_habtm_subjects.rbi +672 -0
  113. data/spec/test_data/v5.1/expected_habtm_wizards.rbi +672 -0
  114. data/spec/test_data/v5.1/expected_headmaster.rbi +464 -0
  115. data/spec/test_data/v5.1/expected_internal_metadata.rbi +0 -217
  116. data/spec/test_data/v5.1/expected_potion.rbi +0 -217
  117. data/spec/test_data/v5.1/expected_robe.rbi +0 -217
  118. data/spec/test_data/v5.1/expected_schema_migration.rbi +0 -217
  119. data/spec/test_data/v5.1/expected_school.rbi +11 -217
  120. data/spec/test_data/v5.1/expected_spell.rbi +452 -0
  121. data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +455 -0
  122. data/spec/test_data/v5.1/expected_spell_book.rbi +14 -222
  123. data/spec/test_data/v5.1/expected_spell_book/habtm_spell_books.rbi +649 -0
  124. data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +455 -0
  125. data/spec/test_data/v5.1/expected_squib.rbi +14 -219
  126. data/spec/test_data/v5.1/expected_subject.rbi +452 -0
  127. data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +455 -0
  128. data/spec/test_data/v5.1/expected_wand.rbi +4 -221
  129. data/spec/test_data/v5.1/expected_wizard.rbi +36 -240
  130. data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +455 -0
  131. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +30 -240
  132. data/spec/test_data/v5.2/expected_active_record_base.rbi +113 -0
  133. data/spec/test_data/v5.2/expected_active_record_relation.rbi +175 -0
  134. data/spec/test_data/v5.2/expected_attachment.rbi +0 -217
  135. data/spec/test_data/v5.2/expected_blob.rbi +3 -217
  136. data/spec/test_data/v5.2/expected_habtm_subjects.rbi +672 -0
  137. data/spec/test_data/v5.2/expected_habtm_wizards.rbi +672 -0
  138. data/spec/test_data/v5.2/expected_headmaster.rbi +464 -0
  139. data/spec/test_data/v5.2/expected_internal_metadata.rbi +0 -217
  140. data/spec/test_data/v5.2/expected_potion.rbi +0 -217
  141. data/spec/test_data/v5.2/expected_robe.rbi +0 -217
  142. data/spec/test_data/v5.2/expected_schema_migration.rbi +0 -217
  143. data/spec/test_data/v5.2/expected_school.rbi +11 -217
  144. data/spec/test_data/v5.2/expected_spell.rbi +452 -0
  145. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +455 -0
  146. data/spec/test_data/v5.2/expected_spell_book.rbi +14 -222
  147. data/spec/test_data/v5.2/expected_spell_book/habtm_spell_books.rbi +649 -0
  148. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +455 -0
  149. data/spec/test_data/v5.2/expected_squib.rbi +20 -219
  150. data/spec/test_data/v5.2/expected_subject.rbi +452 -0
  151. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +455 -0
  152. data/spec/test_data/v5.2/expected_wand.rbi +4 -221
  153. data/spec/test_data/v5.2/expected_wizard.rbi +42 -240
  154. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +455 -0
  155. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +36 -240
  156. data/spec/test_data/v6.0/expected_active_record_base.rbi +113 -0
  157. data/spec/test_data/v6.0/expected_active_record_relation.rbi +175 -0
  158. data/spec/test_data/v6.0/expected_attachment.rbi +0 -217
  159. data/spec/test_data/v6.0/expected_blob.rbi +3 -217
  160. data/spec/test_data/v6.0/expected_habtm_subjects.rbi +720 -0
  161. data/spec/test_data/v6.0/expected_habtm_wizards.rbi +720 -0
  162. data/spec/test_data/v6.0/expected_headmaster.rbi +512 -0
  163. data/spec/test_data/v6.0/expected_internal_metadata.rbi +0 -217
  164. data/spec/test_data/v6.0/expected_potion.rbi +0 -217
  165. data/spec/test_data/v6.0/expected_robe.rbi +0 -217
  166. data/spec/test_data/v6.0/expected_schema_migration.rbi +0 -217
  167. data/spec/test_data/v6.0/expected_school.rbi +11 -217
  168. data/spec/test_data/v6.0/expected_spell.rbi +500 -0
  169. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +503 -0
  170. data/spec/test_data/v6.0/expected_spell_book.rbi +14 -222
  171. data/spec/test_data/v6.0/expected_spell_book/habtm_spell_books.rbi +697 -0
  172. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +503 -0
  173. data/spec/test_data/v6.0/expected_squib.rbi +20 -219
  174. data/spec/test_data/v6.0/expected_subject.rbi +500 -0
  175. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +503 -0
  176. data/spec/test_data/v6.0/expected_wand.rbi +4 -221
  177. data/spec/test_data/v6.0/expected_wizard.rbi +42 -240
  178. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +503 -0
  179. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +36 -240
  180. metadata +169 -14
  181. data/lib/bundled_rbi/active_record_base.rbi +0 -83
  182. data/lib/bundled_rbi/active_record_relation.rbi +0 -122
  183. data/lib/sorbet-rails/model_plugins/active_record_finder_methods.rb +0 -131
  184. data/spec/support/v5.0/typed-override.yaml +0 -2
  185. data/spec/support/v5.1/typed-override.yaml +0 -2
  186. data/spec/support/v5.2/typed-override.yaml +0 -2
  187. data/spec/support/v6.0/typed-override.yaml +0 -2
@@ -29,6 +29,16 @@ module School::GeneratedAttributeMethods
29
29
  def name?; end
30
30
  end
31
31
 
32
+ module School::GeneratedAssociationMethods
33
+ extend T::Sig
34
+
35
+ sig { returns(::Headmaster) }
36
+ def headmaster; end
37
+
38
+ sig { params(value: ::Headmaster).void }
39
+ def headmaster=(value); end
40
+ end
41
+
32
42
  module School::CustomFinderMethods
33
43
  sig { params(limit: Integer).returns(T::Array[School]) }
34
44
  def first_n(limit); end
@@ -48,6 +58,7 @@ end
48
58
 
49
59
  class School < ApplicationRecord
50
60
  include School::GeneratedAttributeMethods
61
+ include School::GeneratedAssociationMethods
51
62
  extend School::CustomFinderMethods
52
63
  extend T::Sig
53
64
  extend T::Generic
@@ -151,30 +162,11 @@ class School < ApplicationRecord
151
162
 
152
163
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(School::ActiveRecord_Relation) }
153
164
  def self.extending(*args, &block); end
154
-
155
- sig { params(conditions: T.untyped).returns(T::Boolean) }
156
- def self.exists?(conditions = nil); end
157
-
158
- sig { params(args: T.untyped).returns(T::Boolean) }
159
- def self.any?(*args); end
160
-
161
- sig { params(args: T.untyped).returns(T::Boolean) }
162
- def self.many?(*args); end
163
-
164
- sig { params(args: T.untyped).returns(T::Boolean) }
165
- def self.none?(*args); end
166
-
167
- sig { params(args: T.untyped).returns(T::Boolean) }
168
- def self.one?(*args); end
169
-
170
- sig { params(args: T.untyped).returns(T::Boolean) }
171
- def self.empty?(*args); end
172
165
  end
173
166
 
174
167
  class School::ActiveRecord_Relation < ActiveRecord::Relation
175
168
  include School::ActiveRelation_WhereNot
176
169
  include School::CustomFinderMethods
177
- include Enumerable
178
170
  extend T::Sig
179
171
  extend T::Generic
180
172
  Elem = type_member(fixed: School)
@@ -277,30 +269,11 @@ class School::ActiveRecord_Relation < ActiveRecord::Relation
277
269
 
278
270
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(School::ActiveRecord_Relation) }
279
271
  def extending(*args, &block); end
280
-
281
- sig { params(conditions: T.untyped).returns(T::Boolean) }
282
- def exists?(conditions = nil); end
283
-
284
- sig { params(args: T.untyped).returns(T::Boolean) }
285
- def any?(*args); end
286
-
287
- sig { params(args: T.untyped).returns(T::Boolean) }
288
- def many?(*args); end
289
-
290
- sig { params(args: T.untyped).returns(T::Boolean) }
291
- def none?(*args); end
292
-
293
- sig { params(args: T.untyped).returns(T::Boolean) }
294
- def one?(*args); end
295
-
296
- sig { params(args: T.untyped).returns(T::Boolean) }
297
- def empty?(*args); end
298
272
  end
299
273
 
300
274
  class School::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelation
301
275
  include School::ActiveRelation_WhereNot
302
276
  include School::CustomFinderMethods
303
- include Enumerable
304
277
  extend T::Sig
305
278
  extend T::Generic
306
279
  Elem = type_member(fixed: School)
@@ -403,100 +376,10 @@ class School::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelati
403
376
 
404
377
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(School::ActiveRecord_AssociationRelation) }
405
378
  def extending(*args, &block); end
406
-
407
- sig { params(args: T.untyped).returns(School) }
408
- def find(*args); end
409
-
410
- sig { params(args: T.untyped).returns(T.nilable(School)) }
411
- def find_by(*args); end
412
-
413
- sig { params(args: T.untyped).returns(School) }
414
- def find_by!(*args); end
415
-
416
- sig { params(attributes: T.untyped, block: T.nilable(T.proc.params(object: School).void)).returns(School) }
417
- def find_or_initialize_by(attributes, &block); end
418
-
419
- sig { params(attributes: T.untyped, block: T.nilable(T.proc.params(object: School).void)).returns(School) }
420
- def find_or_create_by(attributes, &block); end
421
-
422
- sig { params(attributes: T.untyped, block: T.nilable(T.proc.params(object: School).void)).returns(School) }
423
- def find_or_create_by!(attributes, &block); end
424
-
425
- sig { returns(T.nilable(School)) }
426
- def first; end
427
-
428
- sig { returns(School) }
429
- def first!; end
430
-
431
- sig { returns(T.nilable(School)) }
432
- def second; end
433
-
434
- sig { returns(School) }
435
- def second!; end
436
-
437
- sig { returns(T.nilable(School)) }
438
- def third; end
439
-
440
- sig { returns(School) }
441
- def third!; end
442
-
443
- sig { returns(T.nilable(School)) }
444
- def third_to_last; end
445
-
446
- sig { returns(School) }
447
- def third_to_last!; end
448
-
449
- sig { returns(T.nilable(School)) }
450
- def second_to_last; end
451
-
452
- sig { returns(School) }
453
- def second_to_last!; end
454
-
455
- sig { returns(T.nilable(School)) }
456
- def last; end
457
-
458
- sig { returns(School) }
459
- def last!; end
460
-
461
- sig { params(conditions: T.untyped).returns(T::Boolean) }
462
- def exists?(conditions = nil); end
463
-
464
- sig { params(args: T.untyped).returns(T::Boolean) }
465
- def any?(*args); end
466
-
467
- sig { params(args: T.untyped).returns(T::Boolean) }
468
- def many?(*args); end
469
-
470
- sig { params(args: T.untyped).returns(T::Boolean) }
471
- def none?(*args); end
472
-
473
- sig { params(args: T.untyped).returns(T::Boolean) }
474
- def one?(*args); end
475
-
476
- sig { params(args: T.untyped).returns(T::Boolean) }
477
- def empty?(*args); end
478
-
479
- sig { override.params(block: T.proc.params(e: School).void).returns(T::Array[School]) }
480
- def each(&block); end
481
-
482
- sig { params(level: T.nilable(Integer)).returns(T::Array[School]) }
483
- def flatten(level); end
484
-
485
- sig { returns(T::Array[School]) }
486
- def to_a; end
487
-
488
- sig do
489
- type_parameters(:U).params(
490
- blk: T.proc.params(arg0: Elem).returns(T.type_parameter(:U)),
491
- )
492
- .returns(T::Array[T.type_parameter(:U)])
493
- end
494
- def map(&blk); end
495
379
  end
496
380
 
497
381
  class School::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
498
382
  include School::CustomFinderMethods
499
- include Enumerable
500
383
  extend T::Sig
501
384
  extend T::Generic
502
385
  Elem = type_member(fixed: School)
@@ -600,95 +483,6 @@ class School::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associat
600
483
  sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(School::ActiveRecord_AssociationRelation) }
601
484
  def extending(*args, &block); end
602
485
 
603
- sig { params(args: T.untyped).returns(School) }
604
- def find(*args); end
605
-
606
- sig { params(args: T.untyped).returns(T.nilable(School)) }
607
- def find_by(*args); end
608
-
609
- sig { params(args: T.untyped).returns(School) }
610
- def find_by!(*args); end
611
-
612
- sig { params(attributes: T.untyped, block: T.nilable(T.proc.params(object: School).void)).returns(School) }
613
- def find_or_initialize_by(attributes, &block); end
614
-
615
- sig { params(attributes: T.untyped, block: T.nilable(T.proc.params(object: School).void)).returns(School) }
616
- def find_or_create_by(attributes, &block); end
617
-
618
- sig { params(attributes: T.untyped, block: T.nilable(T.proc.params(object: School).void)).returns(School) }
619
- def find_or_create_by!(attributes, &block); end
620
-
621
- sig { returns(T.nilable(School)) }
622
- def first; end
623
-
624
- sig { returns(School) }
625
- def first!; end
626
-
627
- sig { returns(T.nilable(School)) }
628
- def second; end
629
-
630
- sig { returns(School) }
631
- def second!; end
632
-
633
- sig { returns(T.nilable(School)) }
634
- def third; end
635
-
636
- sig { returns(School) }
637
- def third!; end
638
-
639
- sig { returns(T.nilable(School)) }
640
- def third_to_last; end
641
-
642
- sig { returns(School) }
643
- def third_to_last!; end
644
-
645
- sig { returns(T.nilable(School)) }
646
- def second_to_last; end
647
-
648
- sig { returns(School) }
649
- def second_to_last!; end
650
-
651
- sig { returns(T.nilable(School)) }
652
- def last; end
653
-
654
- sig { returns(School) }
655
- def last!; end
656
-
657
- sig { params(conditions: T.untyped).returns(T::Boolean) }
658
- def exists?(conditions = nil); end
659
-
660
- sig { params(args: T.untyped).returns(T::Boolean) }
661
- def any?(*args); end
662
-
663
- sig { params(args: T.untyped).returns(T::Boolean) }
664
- def many?(*args); end
665
-
666
- sig { params(args: T.untyped).returns(T::Boolean) }
667
- def none?(*args); end
668
-
669
- sig { params(args: T.untyped).returns(T::Boolean) }
670
- def one?(*args); end
671
-
672
- sig { params(args: T.untyped).returns(T::Boolean) }
673
- def empty?(*args); end
674
-
675
- sig { override.params(block: T.proc.params(e: School).void).returns(T::Array[School]) }
676
- def each(&block); end
677
-
678
- sig { params(level: T.nilable(Integer)).returns(T::Array[School]) }
679
- def flatten(level); end
680
-
681
- sig { returns(T::Array[School]) }
682
- def to_a; end
683
-
684
- sig do
685
- type_parameters(:U).params(
686
- blk: T.proc.params(arg0: Elem).returns(T.type_parameter(:U)),
687
- )
688
- .returns(T::Array[T.type_parameter(:U)])
689
- end
690
- def map(&blk); end
691
-
692
486
  sig { params(records: T.any(School, T::Array[School])).returns(T.self_type) }
693
487
  def <<(*records); end
694
488
 
@@ -0,0 +1,500 @@
1
+ # This is an autogenerated file for dynamic methods in Spell
2
+ # Please rerun bundle exec rake rails_rbi:models[Spell] to regenerate.
3
+
4
+ # typed: strong
5
+ module Spell::ActiveRelation_WhereNot
6
+ sig { params(opts: T.untyped, rest: T.untyped).returns(T.self_type) }
7
+ def not(opts, *rest); end
8
+ end
9
+
10
+ module Spell::GeneratedAttributeMethods
11
+ extend T::Sig
12
+
13
+ sig { returns(Integer) }
14
+ def id; end
15
+
16
+ sig { params(value: T.any(Numeric, ActiveSupport::Duration)).void }
17
+ def id=(value); end
18
+
19
+ sig { returns(T::Boolean) }
20
+ def id?; end
21
+
22
+ sig { returns(T.nilable(String)) }
23
+ def name; end
24
+
25
+ sig { params(value: T.nilable(T.any(String, Symbol))).void }
26
+ def name=(value); end
27
+
28
+ sig { returns(T::Boolean) }
29
+ def name?; end
30
+ end
31
+
32
+ module Spell::GeneratedAssociationMethods
33
+ extend T::Sig
34
+
35
+ sig { returns(::SpellBook::ActiveRecord_Associations_CollectionProxy) }
36
+ def spell_books; end
37
+
38
+ sig { returns(T::Array[Integer]) }
39
+ def spell_book_ids; end
40
+
41
+ sig { params(value: T::Enumerable[::SpellBook]).void }
42
+ def spell_books=(value); end
43
+ end
44
+
45
+ module Spell::CustomFinderMethods
46
+ sig { params(limit: Integer).returns(T::Array[Spell]) }
47
+ def first_n(limit); end
48
+
49
+ sig { params(limit: Integer).returns(T::Array[Spell]) }
50
+ def last_n(limit); end
51
+
52
+ sig { params(args: T::Array[T.any(Integer, String)]).returns(T::Array[Spell]) }
53
+ def find_n(*args); end
54
+
55
+ sig { params(id: Integer).returns(T.nilable(Spell)) }
56
+ def find_by_id(id); end
57
+
58
+ sig { params(id: Integer).returns(Spell) }
59
+ def find_by_id!(id); end
60
+ end
61
+
62
+ class Spell < ApplicationRecord
63
+ include Spell::GeneratedAttributeMethods
64
+ include Spell::GeneratedAssociationMethods
65
+ extend Spell::CustomFinderMethods
66
+ extend T::Sig
67
+ extend T::Generic
68
+ RelationType = T.type_alias { T.any(Spell::ActiveRecord_Relation, Spell::ActiveRecord_Associations_CollectionProxy, Spell::ActiveRecord_AssociationRelation) }
69
+
70
+ sig { returns(Spell::ActiveRecord_Relation) }
71
+ def self.all; end
72
+
73
+ sig { params(block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_Relation) }
74
+ def self.unscoped(&block); end
75
+
76
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
77
+ def self.select(*args); end
78
+
79
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
80
+ def self.reselect(*args); end
81
+
82
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
83
+ def self.order(*args); end
84
+
85
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
86
+ def self.reorder(*args); end
87
+
88
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
89
+ def self.group(*args); end
90
+
91
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
92
+ def self.limit(*args); end
93
+
94
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
95
+ def self.offset(*args); end
96
+
97
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
98
+ def self.joins(*args); end
99
+
100
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
101
+ def self.left_joins(*args); end
102
+
103
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
104
+ def self.left_outer_joins(*args); end
105
+
106
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
107
+ def self.where(*args); end
108
+
109
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
110
+ def self.rewhere(*args); end
111
+
112
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
113
+ def self.preload(*args); end
114
+
115
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
116
+ def self.extract_associated(*args); end
117
+
118
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
119
+ def self.eager_load(*args); end
120
+
121
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
122
+ def self.includes(*args); end
123
+
124
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
125
+ def self.from(*args); end
126
+
127
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
128
+ def self.lock(*args); end
129
+
130
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
131
+ def self.readonly(*args); end
132
+
133
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
134
+ def self.or(*args); end
135
+
136
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
137
+ def self.having(*args); end
138
+
139
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
140
+ def self.create_with(*args); end
141
+
142
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
143
+ def self.distinct(*args); end
144
+
145
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
146
+ def self.references(*args); end
147
+
148
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
149
+ def self.none(*args); end
150
+
151
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
152
+ def self.unscope(*args); end
153
+
154
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
155
+ def self.optimizer_hints(*args); end
156
+
157
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
158
+ def self.merge(*args); end
159
+
160
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
161
+ def self.except(*args); end
162
+
163
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
164
+ def self.only(*args); end
165
+
166
+ sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_Relation) }
167
+ def self.extending(*args, &block); end
168
+ end
169
+
170
+ class Spell::ActiveRecord_Relation < ActiveRecord::Relation
171
+ include Spell::ActiveRelation_WhereNot
172
+ include Spell::CustomFinderMethods
173
+ extend T::Sig
174
+ extend T::Generic
175
+ Elem = type_member(fixed: Spell)
176
+
177
+ sig { returns(Spell::ActiveRecord_Relation) }
178
+ def all; end
179
+
180
+ sig { params(block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_Relation) }
181
+ def unscoped(&block); end
182
+
183
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
184
+ def select(*args); end
185
+
186
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
187
+ def reselect(*args); end
188
+
189
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
190
+ def order(*args); end
191
+
192
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
193
+ def reorder(*args); end
194
+
195
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
196
+ def group(*args); end
197
+
198
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
199
+ def limit(*args); end
200
+
201
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
202
+ def offset(*args); end
203
+
204
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
205
+ def joins(*args); end
206
+
207
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
208
+ def left_joins(*args); end
209
+
210
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
211
+ def left_outer_joins(*args); end
212
+
213
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
214
+ def where(*args); end
215
+
216
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
217
+ def rewhere(*args); end
218
+
219
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
220
+ def preload(*args); end
221
+
222
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
223
+ def extract_associated(*args); end
224
+
225
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
226
+ def eager_load(*args); end
227
+
228
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
229
+ def includes(*args); end
230
+
231
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
232
+ def from(*args); end
233
+
234
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
235
+ def lock(*args); end
236
+
237
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
238
+ def readonly(*args); end
239
+
240
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
241
+ def or(*args); end
242
+
243
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
244
+ def having(*args); end
245
+
246
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
247
+ def create_with(*args); end
248
+
249
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
250
+ def distinct(*args); end
251
+
252
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
253
+ def references(*args); end
254
+
255
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
256
+ def none(*args); end
257
+
258
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
259
+ def unscope(*args); end
260
+
261
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
262
+ def optimizer_hints(*args); end
263
+
264
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
265
+ def merge(*args); end
266
+
267
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
268
+ def except(*args); end
269
+
270
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_Relation) }
271
+ def only(*args); end
272
+
273
+ sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_Relation) }
274
+ def extending(*args, &block); end
275
+ end
276
+
277
+ class Spell::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelation
278
+ include Spell::ActiveRelation_WhereNot
279
+ include Spell::CustomFinderMethods
280
+ extend T::Sig
281
+ extend T::Generic
282
+ Elem = type_member(fixed: Spell)
283
+
284
+ sig { returns(Spell::ActiveRecord_AssociationRelation) }
285
+ def all; end
286
+
287
+ sig { params(block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_AssociationRelation) }
288
+ def unscoped(&block); end
289
+
290
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
291
+ def select(*args); end
292
+
293
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
294
+ def reselect(*args); end
295
+
296
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
297
+ def order(*args); end
298
+
299
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
300
+ def reorder(*args); end
301
+
302
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
303
+ def group(*args); end
304
+
305
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
306
+ def limit(*args); end
307
+
308
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
309
+ def offset(*args); end
310
+
311
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
312
+ def joins(*args); end
313
+
314
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
315
+ def left_joins(*args); end
316
+
317
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
318
+ def left_outer_joins(*args); end
319
+
320
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
321
+ def where(*args); end
322
+
323
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
324
+ def rewhere(*args); end
325
+
326
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
327
+ def preload(*args); end
328
+
329
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
330
+ def extract_associated(*args); end
331
+
332
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
333
+ def eager_load(*args); end
334
+
335
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
336
+ def includes(*args); end
337
+
338
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
339
+ def from(*args); end
340
+
341
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
342
+ def lock(*args); end
343
+
344
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
345
+ def readonly(*args); end
346
+
347
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
348
+ def or(*args); end
349
+
350
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
351
+ def having(*args); end
352
+
353
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
354
+ def create_with(*args); end
355
+
356
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
357
+ def distinct(*args); end
358
+
359
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
360
+ def references(*args); end
361
+
362
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
363
+ def none(*args); end
364
+
365
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
366
+ def unscope(*args); end
367
+
368
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
369
+ def optimizer_hints(*args); end
370
+
371
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
372
+ def merge(*args); end
373
+
374
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
375
+ def except(*args); end
376
+
377
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
378
+ def only(*args); end
379
+
380
+ sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_AssociationRelation) }
381
+ def extending(*args, &block); end
382
+ end
383
+
384
+ class Spell::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
385
+ include Spell::CustomFinderMethods
386
+ extend T::Sig
387
+ extend T::Generic
388
+ Elem = type_member(fixed: Spell)
389
+
390
+ sig { returns(Spell::ActiveRecord_AssociationRelation) }
391
+ def all; end
392
+
393
+ sig { params(block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_AssociationRelation) }
394
+ def unscoped(&block); end
395
+
396
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
397
+ def select(*args); end
398
+
399
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
400
+ def reselect(*args); end
401
+
402
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
403
+ def order(*args); end
404
+
405
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
406
+ def reorder(*args); end
407
+
408
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
409
+ def group(*args); end
410
+
411
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
412
+ def limit(*args); end
413
+
414
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
415
+ def offset(*args); end
416
+
417
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
418
+ def joins(*args); end
419
+
420
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
421
+ def left_joins(*args); end
422
+
423
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
424
+ def left_outer_joins(*args); end
425
+
426
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
427
+ def where(*args); end
428
+
429
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
430
+ def rewhere(*args); end
431
+
432
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
433
+ def preload(*args); end
434
+
435
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
436
+ def extract_associated(*args); end
437
+
438
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
439
+ def eager_load(*args); end
440
+
441
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
442
+ def includes(*args); end
443
+
444
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
445
+ def from(*args); end
446
+
447
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
448
+ def lock(*args); end
449
+
450
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
451
+ def readonly(*args); end
452
+
453
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
454
+ def or(*args); end
455
+
456
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
457
+ def having(*args); end
458
+
459
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
460
+ def create_with(*args); end
461
+
462
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
463
+ def distinct(*args); end
464
+
465
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
466
+ def references(*args); end
467
+
468
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
469
+ def none(*args); end
470
+
471
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
472
+ def unscope(*args); end
473
+
474
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
475
+ def optimizer_hints(*args); end
476
+
477
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
478
+ def merge(*args); end
479
+
480
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
481
+ def except(*args); end
482
+
483
+ sig { params(args: T.untyped).returns(Spell::ActiveRecord_AssociationRelation) }
484
+ def only(*args); end
485
+
486
+ sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(Spell::ActiveRecord_AssociationRelation) }
487
+ def extending(*args, &block); end
488
+
489
+ sig { params(records: T.any(Spell, T::Array[Spell])).returns(T.self_type) }
490
+ def <<(*records); end
491
+
492
+ sig { params(records: T.any(Spell, T::Array[Spell])).returns(T.self_type) }
493
+ def append(*records); end
494
+
495
+ sig { params(records: T.any(Spell, T::Array[Spell])).returns(T.self_type) }
496
+ def push(*records); end
497
+
498
+ sig { params(records: T.any(Spell, T::Array[Spell])).returns(T.self_type) }
499
+ def concat(*records); end
500
+ end