sorbet-rails 0.6.5.1 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -2
  3. data/.gitignore +2 -1
  4. data/.travis.yml +1 -1
  5. data/README.md +66 -13
  6. data/Rakefile +3 -3
  7. data/lib/bundled_rbi/customizabel_rbi_formatter.rbi +29 -0
  8. data/lib/bundled_rbi/pluck_to_tstruct.rbi +2 -1
  9. data/lib/bundled_rbi/typed_enum.rbi +7 -0
  10. data/lib/sorbet-rails.rb +1 -3
  11. data/lib/sorbet-rails/active_record_rbi_formatter.rb +6 -6
  12. data/lib/sorbet-rails/config.rb +12 -0
  13. data/lib/sorbet-rails/dependent_gem_rbis/activerecord.rbi +3 -0
  14. data/lib/sorbet-rails/dependent_gem_rbis/parlour.rbi +1896 -0
  15. data/lib/sorbet-rails/deprecation.rb +1 -0
  16. data/lib/sorbet-rails/gem_plugins/attr_json_plugin.rb +137 -0
  17. data/lib/sorbet-rails/gem_plugins/flag_shih_tzu_plugin.rb +201 -0
  18. data/lib/sorbet-rails/gem_plugins/kaminari_plugin.rb +28 -0
  19. data/lib/sorbet-rails/gem_plugins/shrine_plugin.rb +1 -1
  20. data/lib/sorbet-rails/helper_rbi_formatter.rb +1 -1
  21. data/lib/sorbet-rails/job_rbi_formatter.rb +75 -62
  22. data/lib/sorbet-rails/mailer_rbi_formatter.rb +40 -27
  23. data/lib/sorbet-rails/model_column_utils.rb +129 -0
  24. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +40 -1
  25. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +12 -112
  26. data/lib/sorbet-rails/model_plugins/active_record_serialized_attribute.rb +68 -0
  27. data/lib/sorbet-rails/model_plugins/base.rb +6 -8
  28. data/lib/sorbet-rails/model_plugins/plugins.rb +9 -0
  29. data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
  30. data/lib/sorbet-rails/model_utils.rb +5 -2
  31. data/lib/sorbet-rails/rails_mixins/generated_url_helpers.rb +2 -3
  32. data/lib/sorbet-rails/rails_mixins/pluck_to_tstruct.rb +54 -7
  33. data/lib/sorbet-rails/railtie.rb +0 -2
  34. data/lib/sorbet-rails/routes_rbi_formatter.rb +6 -2
  35. data/lib/sorbet-rails/sorbet_utils.rb +152 -150
  36. data/lib/sorbet-rails/tasks/rails_rbi.rake +9 -8
  37. data/sorbet-rails.gemspec +2 -2
  38. data/spec/bin/run_spec.sh +1 -1
  39. data/spec/generators/rails-template.rb +16 -0
  40. data/spec/generators/sorbet_test_cases.rb +28 -56
  41. data/spec/job_rbi_formatter_spec.rb +1 -1
  42. data/spec/pluck_to_tstruct_spec.rb +115 -16
  43. data/spec/rails_helper.rb +3 -7
  44. data/spec/rake_rails_rbi_jobs_spec.rb +20 -0
  45. data/spec/rake_rails_rbi_mailers_spec.rb +21 -0
  46. data/spec/sorbet_spec.rb +5 -5
  47. data/spec/support/v5.0/Gemfile +1 -1
  48. data/spec/support/v5.0/Gemfile.lock +23 -19
  49. data/spec/support/v5.0/app/controllers/application_controller.rb +1 -1
  50. data/spec/support/v5.0/app/models/headmaster.rb +1 -1
  51. data/spec/support/v5.0/app/models/potion.rb +1 -1
  52. data/spec/support/v5.0/app/models/robe.rb +1 -1
  53. data/spec/support/v5.0/app/models/school.rb +1 -1
  54. data/spec/support/v5.0/app/models/spell.rb +1 -1
  55. data/spec/support/v5.0/app/models/subject.rb +1 -1
  56. data/spec/support/v5.0/app/models/wizard.rb +5 -0
  57. data/spec/support/v5.0/config/environments/development.rb +1 -1
  58. data/spec/support/v5.0/config/environments/production.rb +1 -1
  59. data/spec/support/v5.0/config/environments/test.rb +1 -1
  60. data/spec/support/v5.0/config/routes.rb +1 -1
  61. data/spec/support/v5.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  62. data/spec/support/v5.0/db/schema.rb +8 -4
  63. data/spec/support/v5.0/sorbet_test_cases.rb +28 -56
  64. data/spec/support/v5.1/Gemfile.lock +21 -17
  65. data/spec/support/v5.1/app/controllers/application_controller.rb +1 -1
  66. data/spec/support/v5.1/app/models/headmaster.rb +1 -1
  67. data/spec/support/v5.1/app/models/school.rb +1 -1
  68. data/spec/support/v5.1/app/models/wizard.rb +5 -0
  69. data/spec/support/v5.1/config/environments/production.rb +1 -1
  70. data/spec/support/v5.1/config/routes.rb +1 -1
  71. data/spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  72. data/spec/support/v5.1/db/schema.rb +5 -1
  73. data/spec/support/v5.1/sorbet_test_cases.rb +28 -56
  74. data/spec/support/v5.2/Gemfile +1 -1
  75. data/spec/support/v5.2/Gemfile.lock +23 -19
  76. data/spec/support/v5.2/app/models/headmaster.rb +1 -1
  77. data/spec/support/v5.2/app/models/school.rb +1 -1
  78. data/spec/support/v5.2/app/models/wizard.rb +5 -0
  79. data/spec/support/v5.2/config/environments/development.rb +1 -1
  80. data/spec/support/v5.2/config/environments/production.rb +1 -1
  81. data/spec/support/v5.2/config/environments/test.rb +1 -1
  82. data/spec/support/v5.2/config/routes.rb +1 -1
  83. data/spec/support/v5.2/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  84. data/spec/support/v5.2/db/schema.rb +5 -1
  85. data/spec/support/v5.2/sorbet_test_cases.rb +28 -56
  86. data/spec/support/v6.0/.gitignore +6 -0
  87. data/spec/support/v6.0/Gemfile +3 -3
  88. data/spec/support/v6.0/Gemfile.lock +89 -84
  89. data/spec/support/v6.0/app/models/wizard.rb +5 -0
  90. data/spec/support/v6.0/bin/bundle +22 -13
  91. data/spec/support/v6.0/config/environments/development.rb +1 -1
  92. data/spec/support/v6.0/config/environments/production.rb +1 -1
  93. data/spec/support/v6.0/config/environments/test.rb +2 -2
  94. data/spec/support/v6.0/config/routes.rb +1 -1
  95. data/spec/support/v6.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  96. data/spec/support/v6.0/db/schema.rb +5 -1
  97. data/spec/support/v6.0/sorbet_test_cases.rb +28 -56
  98. data/spec/support/v6.0/tmp/pids/.keep +0 -0
  99. data/spec/test_data/v5.0/expected_active_record_relation.rbi +0 -1
  100. data/spec/test_data/v5.0/expected_application_job.rbi +2 -2
  101. data/spec/test_data/v5.0/expected_award_house_point_hourglasses.rbi +2 -2
  102. data/spec/test_data/v5.0/expected_custom_application_job.rbi +21 -0
  103. data/spec/test_data/v5.0/expected_custom_application_mailer.rbi +6 -0
  104. data/spec/test_data/v5.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
  105. data/spec/test_data/v5.0/expected_custom_daily_prophet_mailer.rbi +8 -0
  106. data/spec/test_data/v5.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  107. data/spec/test_data/v5.0/expected_headmaster.rbi +24 -0
  108. data/spec/test_data/v5.0/expected_potion.rbi +12 -0
  109. data/spec/test_data/v5.0/expected_robe.rbi +12 -0
  110. data/spec/test_data/v5.0/expected_routes.rbi +4 -0
  111. data/spec/test_data/v5.0/expected_school.rbi +12 -0
  112. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +24 -0
  113. data/spec/test_data/v5.0/expected_spell_book.rbi +21 -9
  114. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +24 -0
  115. data/spec/test_data/v5.0/expected_squib.rbi +63 -0
  116. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +24 -0
  117. data/spec/test_data/v5.0/expected_wand.rbi +22 -10
  118. data/spec/test_data/v5.0/expected_wizard.rbi +121 -58
  119. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +24 -0
  120. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +121 -58
  121. data/spec/test_data/v5.1/expected_active_record_relation.rbi +0 -1
  122. data/spec/test_data/v5.1/expected_application_job.rbi +2 -2
  123. data/spec/test_data/v5.1/expected_award_house_point_hourglasses.rbi +2 -2
  124. data/spec/test_data/v5.1/expected_custom_application_job.rbi +21 -0
  125. data/spec/test_data/v5.1/expected_custom_application_mailer.rbi +6 -0
  126. data/spec/test_data/v5.1/expected_custom_award_house_point_hourglasses.rbi +21 -0
  127. data/spec/test_data/v5.1/expected_custom_daily_prophet_mailer.rbi +8 -0
  128. data/spec/test_data/v5.1/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  129. data/spec/test_data/v5.1/expected_headmaster.rbi +24 -0
  130. data/spec/test_data/v5.1/expected_potion.rbi +12 -0
  131. data/spec/test_data/v5.1/expected_robe.rbi +12 -0
  132. data/spec/test_data/v5.1/expected_routes.rbi +4 -0
  133. data/spec/test_data/v5.1/expected_school.rbi +12 -0
  134. data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +24 -0
  135. data/spec/test_data/v5.1/expected_spell_book.rbi +21 -9
  136. data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +24 -0
  137. data/spec/test_data/v5.1/expected_squib.rbi +63 -0
  138. data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +24 -0
  139. data/spec/test_data/v5.1/expected_wand.rbi +22 -10
  140. data/spec/test_data/v5.1/expected_wizard.rbi +121 -58
  141. data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +24 -0
  142. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +121 -58
  143. data/spec/test_data/v5.2/expected_active_record_relation.rbi +0 -1
  144. data/spec/test_data/v5.2/expected_application_job.rbi +2 -2
  145. data/spec/test_data/v5.2/expected_attachment.rbi +24 -0
  146. data/spec/test_data/v5.2/expected_award_house_point_hourglasses.rbi +2 -2
  147. data/spec/test_data/v5.2/expected_blob.rbi +25 -1
  148. data/spec/test_data/v5.2/expected_custom_application_job.rbi +21 -0
  149. data/spec/test_data/v5.2/expected_custom_application_mailer.rbi +6 -0
  150. data/spec/test_data/v5.2/expected_custom_award_house_point_hourglasses.rbi +21 -0
  151. data/spec/test_data/v5.2/expected_custom_daily_prophet_mailer.rbi +8 -0
  152. data/spec/test_data/v5.2/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  153. data/spec/test_data/v5.2/expected_headmaster.rbi +24 -0
  154. data/spec/test_data/v5.2/expected_potion.rbi +12 -0
  155. data/spec/test_data/v5.2/expected_robe.rbi +12 -0
  156. data/spec/test_data/v5.2/expected_routes.rbi +4 -0
  157. data/spec/test_data/v5.2/expected_school.rbi +12 -0
  158. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +24 -0
  159. data/spec/test_data/v5.2/expected_spell_book.rbi +21 -9
  160. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +24 -0
  161. data/spec/test_data/v5.2/expected_squib.rbi +89 -2
  162. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +24 -0
  163. data/spec/test_data/v5.2/expected_wand.rbi +22 -10
  164. data/spec/test_data/v5.2/expected_wizard.rbi +147 -60
  165. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +24 -0
  166. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +147 -60
  167. data/spec/test_data/v6.0/expected_active_record_relation.rbi +0 -1
  168. data/spec/test_data/v6.0/expected_application_job.rbi +2 -2
  169. data/spec/test_data/v6.0/expected_attachment.rbi +24 -0
  170. data/spec/test_data/v6.0/expected_award_house_point_hourglasses.rbi +2 -2
  171. data/spec/test_data/v6.0/expected_blob.rbi +25 -1
  172. data/spec/test_data/v6.0/expected_custom_application_job.rbi +21 -0
  173. data/spec/test_data/v6.0/expected_custom_application_mailer.rbi +6 -0
  174. data/spec/test_data/v6.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
  175. data/spec/test_data/v6.0/expected_custom_daily_prophet_mailer.rbi +8 -0
  176. data/spec/test_data/v6.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  177. data/spec/test_data/v6.0/expected_headmaster.rbi +24 -0
  178. data/spec/test_data/v6.0/expected_potion.rbi +12 -0
  179. data/spec/test_data/v6.0/expected_robe.rbi +12 -0
  180. data/spec/test_data/v6.0/expected_routes.rbi +4 -0
  181. data/spec/test_data/v6.0/expected_school.rbi +12 -0
  182. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +24 -0
  183. data/spec/test_data/v6.0/expected_spell_book.rbi +21 -9
  184. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +24 -0
  185. data/spec/test_data/v6.0/expected_squib.rbi +89 -2
  186. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +24 -0
  187. data/spec/test_data/v6.0/expected_wand.rbi +22 -10
  188. data/spec/test_data/v6.0/expected_wizard.rbi +147 -60
  189. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +24 -0
  190. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +147 -60
  191. data/spec/tstruct_comparable.rb +13 -0
  192. metadata +64 -15
  193. data/lib/bundled_rbi/parameters.rbi +0 -28
  194. data/lib/sorbet-rails/custom_types/boolean_string.rb +0 -42
  195. data/lib/sorbet-rails/custom_types/integer_string.rb +0 -45
  196. data/lib/sorbet-rails/rails_mixins/custom_params_methods.rb +0 -57
  197. data/spec/boolean_string_spec.rb +0 -59
  198. data/spec/custom_params_methods_spec.rb +0 -138
  199. data/spec/integer_string_spec.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6f3cc66ce41d3adeddca63531a8d5f6dd98ccc8f936a41d89215ed33423bc2d
4
- data.tar.gz: 9ca5aa9adc679b3e230f3a2fa0c1116bd679a42af9df53821ccbbace6ad6db67
3
+ metadata.gz: 33c9dda20b44067f6f788873f626fd9d2fdf5bbe8a62d8c374e2748b637f5993
4
+ data.tar.gz: e2d65d1ec7c2e03d7135d7de8540b859c6348d27382732893fff611a5b627d88
5
5
  SHA512:
6
- metadata.gz: 012505f4ca8d8eed70dba2309dcdecba0fcd76d8695e55e5301fe9c16c033ffccb330acc631a5f38a867f4b8b7dc73e665bad40d3bca767096b741b10c745d95
7
- data.tar.gz: c8b3e2eb74c5bc1f44cc3130deb36c693c4b24aeed08698d4c36da28794f12b228c5b855030106e3b4d41f6d79bb71f38c90c674561551621599051629186931
6
+ metadata.gz: 86a4cc741bef3972a5a8cb3a77d1eaa1f1fe4924d816c5ba681bf6fe5b5d91d0b6e94410a2a08fe15b8d696b80e50b7ff7f4c5a049e58a841fa9d2ecd83fd9c0
7
+ data.tar.gz: 6120f8d8fdf6e631f92cf6428774cd6df1a410d64282d96ed4921202c1715e2211e15823a510234849615cb7e3dc08368121fd663ad1ab9148ad337123799dca
data/.gitattributes CHANGED
@@ -1,4 +1,3 @@
1
- lib/sorbet/* linguist-generated
2
1
  spec/test_data/* linguist-generated
3
2
  spec/support/* linguist-generated
4
-
3
+ sorbet/* linguist-generated
data/.gitignore CHANGED
@@ -79,6 +79,7 @@ build-iPhoneSimulator/
79
79
  /spec/support/**/config/credentials.yml.enc
80
80
 
81
81
  # Ignore sorbet generated files
82
+ /sorbet/rbi/hidden-definitions/
82
83
  /spec/support/**/sorbet/*
83
84
  /spec/support/**/sorbet/**/*
84
85
 
@@ -93,7 +94,7 @@ build-iPhoneSimulator/
93
94
  *.swl
94
95
  *.swk
95
96
 
96
- lib/sorbet/rbi/hidden-definitions/errors.txt
97
+ sorbet/rbi/hidden-definitions/errors.txt
97
98
  .vscode
98
99
 
99
100
  .rake_tasks~
data/.travis.yml CHANGED
@@ -16,7 +16,7 @@ rvm:
16
16
  matrix:
17
17
  include:
18
18
  - rvm: 2.5
19
- env: RAILS_VERSION=5.2 SORBET_VERSION=0.5.5400
19
+ env: RAILS_VERSION=5.2 SORBET_VERSION=0.5.6210
20
20
  exclude:
21
21
  - rvm: 2.3
22
22
  env: RAILS_VERSION=6.0
data/README.md CHANGED
@@ -9,7 +9,7 @@ This gem adds a few Rake tasks to generate Ruby Interface (RBI) files for dynami
9
9
 
10
10
  `sorbet-rails` supports Rails 5+ or later.
11
11
 
12
- **Notice**: we no longer supports Rails 4.2. [Version 0.5.6](https://github.com/chanzuckerberg/sorbet-rails/releases/tag/v0.5.6) is the last version supporting Rails 4.2.
12
+ **Notice**: we no longer support Rails 4.2. [Version 0.5.6](https://github.com/chanzuckerberg/sorbet-rails/releases/tag/v0.5.6) is the last version supporting Rails 4.2.
13
13
 
14
14
  ## Initial Setup
15
15
 
@@ -43,8 +43,8 @@ Add `sorbet-rails` to the [`:default` group](https://bundler.io/v2.0/guides/grou
43
43
 
44
44
  4. Update hidden-definition files and automatically upgrade each file's typecheck level:
45
45
  ```sh
46
- ❯ srb rbi hidden-definitions
47
- ❯ srb rbi suggest-typed
46
+ bundle exec srb rbi hidden-definitions
47
+ bundle exec srb rbi suggest-typed
48
48
  ```
49
49
  Because we've generated RBI files for routes, models, and helpers, a lot more files should be typecheckable now. Many methods in `hidden.rbi` may be removed because they are now typed.
50
50
 
@@ -94,6 +94,28 @@ Wizard.pluck_to_tstruct(TA[WizardStruct].new) # T::Array[WizardStruct]
94
94
  Wizard.all.pluck_to_tstruct(TA[WizardStruct].new) # T::Array[WizardStruct]
95
95
  ```
96
96
 
97
+ You can also pass a keyword argument called `associations` that represents a mapping of a `T::Struct`'s keys to an associated table's columns.
98
+ ```ruby
99
+ # -- API
100
+ Arel.pluck_to_tstruct(TA[ <TStructSubclass> ].new, associations: < Hash<Symbol, String> >)
101
+
102
+ # -- example
103
+ class WizardWithWandStruct < T::Struct
104
+ const :name, String
105
+ const :house, T.nilable(String)
106
+ const :wand_wood_type, String
107
+ end
108
+
109
+ Wizard.joins(:wand).pluck_to_tstruct(
110
+ TA[WizardWithWandStruct].new,
111
+ associations: { wand_wood_type: "wands.wood_type" }
112
+ )
113
+ Wizard.all.joins(:wand).pluck_to_tstruct(
114
+ TA[WizardWithWandStruct].new,
115
+ associations: { wand_wood_type: "wands.wood_type" }
116
+ )
117
+ ````
118
+
97
119
  This method is based on [pluck_to_hash](https://github.com/girishso/pluck_to_hash) gem.
98
120
 
99
121
  #### `typed_enum` instead of `enum`
@@ -114,12 +136,14 @@ ie.
114
136
  Will generate this enum:
115
137
 
116
138
  ```ruby
117
- class Wizard::House < T::Enum
118
- enums do
119
- Gryffindor = new('Gryffindor')
120
- Hufflepuff = new('Hufflepuff')
121
- Ravenclaw = new('Ravenclaw')
122
- Slytherin = new('Slytherin')
139
+ class Wizard
140
+ class House < T::Enum
141
+ enums do
142
+ Gryffindor = new('Gryffindor')
143
+ Hufflepuff = new('Hufflepuff')
144
+ Ravenclaw = new('Ravenclaw')
145
+ Slytherin = new('Slytherin')
146
+ end
123
147
  end
124
148
  end
125
149
  ```
@@ -412,11 +436,13 @@ If you run into the following issue when running rspec, it's likely because you'
412
436
  if you're really stuck.
413
437
  ```
414
438
 
415
- ## Extending Model Generation Task with Custom Plugins
439
+ ## Extending RBI Generation logic
440
+
441
+ ### Extending Model Generation Task with Custom Plugins
416
442
 
417
443
  `sorbet-rails` support a customizable plugin system that you can use to generate additional RBI for each model. This will be useful to generate RBI for methods dynamically added by gems or private concerns. If you write plugins for public gems, please feel free to contribute it to this repo.
418
444
 
419
- ### Defining a Custom `ModelPlugin`
445
+ #### Defining a Custom `ModelPlugin`
420
446
 
421
447
  A custom plugin should be a subclass of `SorbetRails::ModelPlugins::Base`. Each plugin would implement a `generate(root)` method that generate additional rbi for the model.
422
448
 
@@ -465,14 +491,14 @@ It is also recommended to check if the generated methods are detected by `sorbet
465
491
 
466
492
  Check out the [plugins](https://github.com/chanzuckerberg/sorbet-rails/tree/master/lib/sorbet-rails/model_plugins) written for `sorbet-rails`'s own model RBI generation logic for examples.
467
493
 
468
- ### Registering new plugins
494
+ #### Registering new plugins
469
495
  You can register your plugins in an initializer:
470
496
  ```ruby
471
497
  # -- config/initializers/sorbet_rails.rb
472
498
  SorbetRails::ModelRbiFormatter.register_plugin(MyCustomPlugin)
473
499
  ```
474
500
 
475
- ### Enabling built-in plugins
501
+ #### Enabling built-in plugins
476
502
 
477
503
  sorbet-rails comes with a handful of gem plugins that can be enabled in an initializer. You can pass enabled gem plugins to `config.enabled_gem_plugins`, like so:
478
504
 
@@ -496,6 +522,8 @@ These are the currently-supported gems and their symbolized names:
496
522
  | [Shrine] | `:shrine` |
497
523
  | [active_flag]| `:active_flag` |
498
524
  | [Paperclip] | `:paperclip` |
525
+ | [AttrJson] | `:attr_json` |
526
+ | [FlagShihTzu] | `:flag_shih_tzu` |
499
527
 
500
528
  You can also configure the core model plugins if needed. The default plugins are defined in the [config](https://github.com/chanzuckerberg/sorbet-rails/blob/master/lib/sorbet-rails/config.rb). For the full list of plugin symbols, check out [here](https://github.com/chanzuckerberg/sorbet-rails/blob/master/lib/sorbet-rails/model_plugins/plugins.rb).
501
529
 
@@ -507,6 +535,31 @@ You can also configure the core model plugins if needed. The default plugins are
507
535
  [Shrine]: https://github.com/shrinerb/shrine
508
536
  [active_flag]: https://github.com/kenn/active_flag
509
537
  [Paperclip]: https://github.com/thoughtbot/paperclip
538
+ [AttrJson]: https://github.com/jrochkind/attr_json
539
+ [FlagShihTzu]: https://github.com/pboling/flag_shih_tzu
540
+
541
+ ### Customize Generation Class
542
+
543
+ For mailer and job rbi generation, you can customize the logic by
544
+ setting the generation class in the config:
545
+
546
+ ```ruby
547
+ SorbetRails.configure do |config|
548
+ config.job_generator_class = CustomJobRbiGenerator
549
+ config.mailer_generator_class = CustomMailerRbiGenerator
550
+ end
551
+ ```
552
+
553
+ The custom generator can subclass the [provided generators](lib/bundled_rbi/customizabel_rbi_formatter.rbi) and override the populate_rbi method. For example:
554
+
555
+ ```ruby
556
+ class CustomJobRbiGenerator < SorbetRails::JobRbiFormatter
557
+ def populate_rbi
558
+ rbi_generator.root.add_comment("== Custom Generator ==")
559
+ super
560
+ end
561
+ end
562
+ ```
510
563
 
511
564
  ## Contributing
512
565
 
data/Rakefile CHANGED
@@ -20,9 +20,9 @@ namespace :update_spec do
20
20
  task :v6_0 do |t, args|
21
21
  Bundler.with_clean_env do
22
22
  FileUtils.rm_rf 'spec/support/v6.0' if File.directory?('spec/support/v6.0')
23
- system("gem install rails -v 6.0.0")
24
- system("rails _6.0.0_ -v")
25
- system("RAILS_VERSION='6.0' rails _6.0.0_ new --template spec/generators/rails-template.rb spec/support/v6.0 --skip-javascript --skip-action-cable --skip-test --skip-sprockets --skip-spring --skip-bootsnap --skip-listen")
23
+ system("gem install rails -v 6.0.3")
24
+ system("rails _6.0.3_ -v")
25
+ system("RAILS_VERSION='6.0' rails _6.0.3_ new --template spec/generators/rails-template.rb spec/support/v6.0 --skip-javascript --skip-action-cable --skip-test --skip-sprockets --skip-spring --skip-bootsnap --skip-listen")
26
26
  end
27
27
  end
28
28
 
@@ -0,0 +1,29 @@
1
+ # typed: strong
2
+ module SorbetRails
3
+ class MailerRbiFormatter
4
+ extend T::Sig
5
+ Parameter = ::Parlour::RbiGenerator::Parameter
6
+
7
+ sig { returns(T.class_of(ActionMailer::Base)) }
8
+ attr_reader :mailer_class
9
+
10
+ sig { returns(Parlour::RbiGenerator) }
11
+ def rbi_generator; end
12
+
13
+ sig { void }
14
+ def populate_rbi; end
15
+ end
16
+
17
+ class JobRbiFormatter
18
+ Parameter = ::Parlour::RbiGenerator::Parameter
19
+
20
+ sig { returns(Parlour::RbiGenerator) }
21
+ attr_reader :rbi_generator
22
+
23
+ sig { returns(T.class_of(ActiveJob::Base)) }
24
+ attr_reader :job_class
25
+
26
+ sig { void }
27
+ def populate_rbi; end
28
+ end
29
+ end
@@ -6,10 +6,11 @@ module SorbetRails::PluckToTStruct
6
6
  type_parameters(:U).
7
7
  params(
8
8
  ta_struct: ITypeAssert[T.type_parameter(:U)],
9
+ associations: T::Hash[Symbol, String],
9
10
  ).
10
11
  returns(T::Array[T.type_parameter(:U)])
11
12
  }
12
- def pluck_to_tstruct(ta_struct, &blk); end
13
+ def pluck_to_tstruct(ta_struct, associations: {}); end
13
14
  end
14
15
 
15
16
  class ActiveRecord::Base
@@ -0,0 +1,7 @@
1
+ # typed: strong
2
+ module ActiveRecord::Enum
3
+
4
+ sig { params(definitions: T::Hash[Symbol, T.untyped]).void }
5
+ def typed_enum(definitions); end
6
+
7
+ end
data/lib/sorbet-rails.rb CHANGED
@@ -1,11 +1,9 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  module SorbetRails
3
3
  if defined?(Rails)
4
4
  require 'sorbet-rails/railtie'
5
5
  require 'sorbet-rails/model_rbi_formatter'
6
6
  require 'sorbet-rails/type_assert/type_assert'
7
- require 'sorbet-rails/custom_types/integer_string'
8
- require 'sorbet-rails/custom_types/boolean_string'
9
7
  require 'sorbet-rails/typed_params'
10
8
  end
11
9
  end
@@ -12,7 +12,7 @@ class SorbetRails::ActiveRecordRbiFormatter
12
12
 
13
13
  parlour = T.let(Parlour::RbiGenerator.new, Parlour::RbiGenerator)
14
14
 
15
- parlour.root.add_comments([
15
+ parlour.root.add_comment([
16
16
  'This is an autogenerated file for Rails\' ActiveRecord.',
17
17
  'Please rerun bundle exec rake rails_rbi:active_record to regenerate.'
18
18
  ])
@@ -31,17 +31,17 @@ class SorbetRails::ActiveRecordRbiFormatter
31
31
 
32
32
  parlour = T.let(Parlour::RbiGenerator.new, Parlour::RbiGenerator)
33
33
 
34
- parlour.root.add_comments([
34
+ parlour.root.add_comment([
35
35
  'This is an autogenerated file for Rails\' ActiveRecord.',
36
36
  'Please rerun bundle exec rake rails_rbi:active_record to regenerate.'
37
37
  ])
38
38
 
39
39
  parlour.root.create_class('ActiveRecord::Relation') do |class_rbi|
40
40
  class_rbi.create_include("Enumerable")
41
- class_rbi.create_constant(
42
- "Elem",
43
- value: "type_member(fixed: T.untyped)",
44
- )
41
+ # class_rbi.create_constant(
42
+ # "Elem",
43
+ # value: "type_member(fixed: T.untyped)",
44
+ # )
45
45
 
46
46
  create_elem_specific_query_methods(class_rbi, type: 'Elem', class_method: false)
47
47
  create_general_query_methods(class_rbi, class_method: false)
@@ -1,4 +1,7 @@
1
1
  # typed: true
2
+ require("sorbet-rails/mailer_rbi_formatter")
3
+ require("sorbet-rails/job_rbi_formatter")
4
+
2
5
  module SorbetRails
3
6
  class << self
4
7
  extend T::Sig
@@ -37,6 +40,12 @@ module SorbetRails
37
40
  sig { returns(T::Array[String]) }
38
41
  attr_accessor :extra_helper_includes
39
42
 
43
+ sig { returns(T.class_of(SorbetRails::JobRbiFormatter))}
44
+ attr_accessor :job_generator_class
45
+
46
+ sig { returns(T.class_of(SorbetRails::MailerRbiFormatter))}
47
+ attr_accessor :mailer_generator_class
48
+
40
49
  sig { void }
41
50
  def initialize
42
51
  @enabled_gem_plugins = []
@@ -45,6 +54,7 @@ module SorbetRails
45
54
  :active_record_named_scope,
46
55
  :active_record_querying,
47
56
  :active_relation_where_not,
57
+ :active_record_serialized_attribute,
48
58
  :active_record_attribute,
49
59
  :active_record_assoc,
50
60
  :custom_finder_methods,
@@ -52,6 +62,8 @@ module SorbetRails
52
62
  ]
53
63
  @enabled_model_plugins << :active_storage_methods if defined?(T.unsafe(ActiveStorage))
54
64
  @extra_helper_includes = []
65
+ @mailer_generator_class = SorbetRails::MailerRbiFormatter
66
+ @job_generator_class = SorbetRails::JobRbiFormatter
55
67
  end
56
68
 
57
69
  sig { returns(T::Array[Symbol]) }
@@ -12,6 +12,9 @@ class ActiveRecord::Base < Object
12
12
  sig { returns(T::Hash[String, T.untyped]) }
13
13
  def self.columns_hash; end
14
14
 
15
+ sig { params(column_name: String).returns(T.nilable(T.any(ActiveModel::Type::Value, ActiveRecord::Type::Serialized))) }
16
+ def self.type_for_attribute(column_name); end
17
+
15
18
  sig { returns(T::Hash[String, T.untyped]) }
16
19
  def self.reflections; end
17
20
 
@@ -0,0 +1,1896 @@
1
+ # typed: strong
2
+ module Kernel
3
+ end
4
+
5
+ module Parlour
6
+ VERSION = '6.0.0'
7
+
8
+ class ConflictResolver
9
+ extend T::Sig
10
+
11
+ sig { params(namespace: RbiGenerator::Namespace, resolver: T.proc.params(
12
+ desc: String,
13
+ choices: T::Array[RbiGenerator::RbiObject]
14
+ ).returns(T.nilable(RbiGenerator::RbiObject))).void }
15
+ def resolve_conflicts(namespace, &resolver); end
16
+
17
+ sig { params(arr: T::Array[T.untyped]).returns(T.nilable(Symbol)) }
18
+ def merge_strategy(arr); end
19
+
20
+ sig { params(arr: T::Array[T.untyped]).returns(T::Boolean) }
21
+ def all_eql?(arr); end
22
+
23
+ sig { params(namespace: RbiGenerator::Namespace, name: T.nilable(String)).void }
24
+ def deduplicate_mixins_of_name(namespace, name); end
25
+ end
26
+
27
+ module Debugging
28
+ extend T::Sig
29
+
30
+ sig { params(value: T::Boolean).returns(T::Boolean) }
31
+ def self.debug_mode=(value); end
32
+
33
+ sig { returns(T::Boolean) }
34
+ def self.debug_mode?; end
35
+
36
+ sig { params(object: T.untyped, message: String).void }
37
+ def self.debug_puts(object, message); end
38
+
39
+ sig { params(object: T.untyped).returns(String) }
40
+ def self.name_for_debug_caller(object); end
41
+
42
+ module Tree
43
+ extend T::Sig
44
+ INDENT_SPACES = 2
45
+
46
+ sig { params(message: String).returns(String) }
47
+ def self.begin(message); end
48
+
49
+ sig { params(message: String).returns(String) }
50
+ def self.here(message); end
51
+
52
+ sig { params(message: String).returns(String) }
53
+ def self.end(message); end
54
+
55
+ sig { returns(T.untyped) }
56
+ def self.line_prefix; end
57
+
58
+ sig { returns(T.untyped) }
59
+ def self.text_prefix; end
60
+ end
61
+ end
62
+
63
+ class DetachedRbsGenerator < RbsGenerator
64
+ sig { returns(T.untyped) }
65
+ def detached!; end
66
+
67
+ sig { override.returns(Options) }
68
+ def options; end
69
+
70
+ sig { override.returns(T.nilable(Plugin)) }
71
+ def current_plugin; end
72
+
73
+ sig { override.returns(String) }
74
+ def rbs; end
75
+ end
76
+
77
+ class Generator
78
+ extend T::Sig
79
+
80
+ sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
81
+ def initialize(break_params: 4, tab_size: 2, sort_namespaces: false); end
82
+
83
+ sig { returns(Options) }
84
+ attr_reader :options
85
+
86
+ sig { returns(T.nilable(Plugin)) }
87
+ attr_accessor :current_plugin
88
+ end
89
+
90
+ class Options
91
+ extend T::Sig
92
+
93
+ sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
94
+ def initialize(break_params:, tab_size:, sort_namespaces:); end
95
+
96
+ sig { returns(Integer) }
97
+ attr_reader :break_params
98
+
99
+ sig { returns(Integer) }
100
+ attr_reader :tab_size
101
+
102
+ sig { returns(T::Boolean) }
103
+ attr_reader :sort_namespaces
104
+
105
+ sig { params(level: Integer, str: String).returns(String) }
106
+ def indented(level, str); end
107
+ end
108
+
109
+ class ParseError < StandardError
110
+ extend T::Sig
111
+
112
+ sig { returns(Parser::Source::Buffer) }
113
+ attr_reader :buffer
114
+
115
+ sig { returns(Parser::Source::Range) }
116
+ attr_reader :range
117
+
118
+ sig { params(buffer: T.untyped, range: T.untyped).returns(T.untyped) }
119
+ def initialize(buffer, range); end
120
+ end
121
+
122
+ class Plugin
123
+ abstract!
124
+
125
+ extend T::Sig
126
+ extend T::Helpers
127
+
128
+ sig { returns(T::Hash[String, T.class_of(Plugin)]) }
129
+ def self.registered_plugins; end
130
+
131
+ sig { params(new_plugin: T.class_of(Plugin)).void }
132
+ def self.inherited(new_plugin); end
133
+
134
+ sig { params(plugins: T::Array[Plugin], generator: RbiGenerator, allow_failure: T::Boolean).void }
135
+ def self.run_plugins(plugins, generator, allow_failure: true); end
136
+
137
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
138
+ def initialize(options); end
139
+
140
+ sig { abstract.params(root: RbiGenerator::Namespace).void }
141
+ def generate(root); end
142
+
143
+ sig { returns(T.nilable(String)) }
144
+ attr_accessor :strictness
145
+ end
146
+
147
+ module TypeLoader
148
+ extend T::Sig
149
+
150
+ sig { params(source: String, filename: T.nilable(String), generator: T.nilable(RbiGenerator)).returns(RbiGenerator::Namespace) }
151
+ def self.load_source(source, filename = nil, generator: nil); end
152
+
153
+ sig { params(filename: String, generator: T.nilable(RbiGenerator)).returns(RbiGenerator::Namespace) }
154
+ def self.load_file(filename, generator: nil); end
155
+
156
+ sig do
157
+ params(
158
+ root: String,
159
+ inclusions: T::Array[String],
160
+ exclusions: T::Array[String],
161
+ generator: T.nilable(RbiGenerator)
162
+ ).returns(RbiGenerator::Namespace)
163
+ end
164
+ def self.load_project(root, inclusions: ['.'], exclusions: [], generator: nil); end
165
+ end
166
+
167
+ class TypeParser
168
+ extend T::Sig
169
+
170
+ class NodePath
171
+ extend T::Sig
172
+
173
+ sig { returns(T::Array[Integer]) }
174
+ attr_reader :indices
175
+
176
+ sig { params(indices: T::Array[Integer]).void }
177
+ def initialize(indices); end
178
+
179
+ sig { returns(NodePath) }
180
+ def parent; end
181
+
182
+ sig { params(index: Integer).returns(NodePath) }
183
+ def child(index); end
184
+
185
+ sig { params(offset: Integer).returns(NodePath) }
186
+ def sibling(offset); end
187
+
188
+ sig { params(start: Parser::AST::Node).returns(Parser::AST::Node) }
189
+ def traverse(start); end
190
+ end
191
+
192
+ sig { params(ast: Parser::AST::Node, unknown_node_errors: T::Boolean, generator: T.nilable(RbiGenerator)).void }
193
+ def initialize(ast, unknown_node_errors: false, generator: nil); end
194
+
195
+ sig { params(filename: String, source: String, generator: T.nilable(RbiGenerator)).returns(TypeParser) }
196
+ def self.from_source(filename, source, generator: nil); end
197
+
198
+ sig { returns(Parser::AST::Node) }
199
+ attr_accessor :ast
200
+
201
+ sig { returns(T::Boolean) }
202
+ attr_reader :unknown_node_errors
203
+
204
+ sig { returns(RbiGenerator) }
205
+ attr_accessor :generator
206
+
207
+ sig { returns(RbiGenerator::Namespace) }
208
+ def parse_all; end
209
+
210
+ sig { params(path: NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[RbiGenerator::RbiObject]) }
211
+ def parse_path_to_object(path, is_within_eigenclass: false); end
212
+
213
+ class IntermediateSig < T::Struct
214
+ prop :type_parameters, T.nilable(T::Array[Symbol])
215
+ prop :overridable, T::Boolean
216
+ prop :override, T::Boolean
217
+ prop :abstract, T::Boolean
218
+ prop :final, T::Boolean
219
+ prop :return_type, T.nilable(String)
220
+ prop :params, T.nilable(T::Array[Parser::AST::Node])
221
+
222
+ end
223
+
224
+ sig { params(path: NodePath).returns(IntermediateSig) }
225
+ def parse_sig_into_sig(path); end
226
+
227
+ sig { params(path: NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[RbiGenerator::Method]) }
228
+ def parse_sig_into_methods(path, is_within_eigenclass: false); end
229
+
230
+ sig { params(path: NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[RbiGenerator::Method]) }
231
+ def parse_method_into_methods(path, is_within_eigenclass: false); end
232
+
233
+ sig { params(str: String).returns(Types::Type) }
234
+ def self.parse_single_type(str); end
235
+
236
+ sig { params(node: Parser::AST::Node).returns(Types::Type) }
237
+ def parse_node_to_type(node); end
238
+
239
+ sig { params(msg: String, node: Parser::AST::Node).void }
240
+ def warning(msg, node); end
241
+
242
+ sig { params(node: T.nilable(Parser::AST::Node)).returns(T::Array[Symbol]) }
243
+ def constant_names(node); end
244
+
245
+ sig { params(node: Parser::AST::Node).returns(T::Boolean) }
246
+ def sig_node?(node); end
247
+
248
+ sig { params(path: NodePath).returns(T::Boolean) }
249
+ def previous_sibling_sig_node?(path); end
250
+
251
+ sig { params(node: T.nilable(Parser::AST::Node)).returns(T.nilable(String)) }
252
+ def node_to_s(node); end
253
+
254
+ sig { params(node: T.nilable(Parser::AST::Node), modifier: Symbol).returns(T::Boolean) }
255
+ def body_has_modifier?(node, modifier); end
256
+
257
+ sig { params(node: Parser::AST::Node).returns([T::Array[String], T::Array[String]]) }
258
+ def body_includes_and_extends(node); end
259
+
260
+ sig { params(desc: String, node: T.any(Parser::AST::Node, NodePath)).returns(T.noreturn) }
261
+ def parse_err(desc, node); end
262
+
263
+ sig do
264
+ type_parameters(:A, :B).params(
265
+ a: T::Array[T.type_parameter(:A)],
266
+ fa: T.proc.params(item: T.type_parameter(:A)).returns(T.untyped),
267
+ b: T::Array[T.type_parameter(:B)],
268
+ fb: T.proc.params(item: T.type_parameter(:B)).returns(T.untyped)
269
+ ).returns(T::Array[[T.type_parameter(:A), T.type_parameter(:B)]])
270
+ end
271
+ def zip_by(a, fa, b, fb); end
272
+ end
273
+
274
+ class TypedObject
275
+ abstract!
276
+
277
+ extend T::Sig
278
+ extend T::Helpers
279
+
280
+ sig { params(name: String).void }
281
+ def initialize(name); end
282
+
283
+ sig { returns(T.nilable(Plugin)) }
284
+ attr_reader :generated_by
285
+
286
+ sig { returns(String) }
287
+ attr_reader :name
288
+
289
+ sig { returns(T::Array[String]) }
290
+ attr_reader :comments
291
+
292
+ sig { params(comment: T.any(String, T::Array[String])).void }
293
+ def add_comment(comment); end
294
+
295
+ sig { abstract.returns(String) }
296
+ def describe; end
297
+
298
+ sig { params(indent_level: Integer, options: Options).returns(T::Array[String]) }
299
+ def generate_comments(indent_level, options); end
300
+ end
301
+
302
+ module Types
303
+ TypeLike = T.type_alias { T.any(String, Type) }
304
+
305
+ class Type
306
+ abstract!
307
+
308
+ extend T::Sig
309
+ extend T::Helpers
310
+
311
+ sig { abstract.returns(String) }
312
+ def generate_rbi; end
313
+
314
+ sig { abstract.returns(String) }
315
+ def generate_rbs; end
316
+
317
+ sig { params(type_like: TypeLike).returns(Type) }
318
+ def self.to_type(type_like); end
319
+
320
+ sig { params(type_like: TypeLike).returns(Type) }
321
+ def to_type(type_like); end
322
+
323
+ sig { returns(T.untyped) }
324
+ def hash; end
325
+
326
+ sig { abstract.returns(String) }
327
+ def describe; end
328
+ end
329
+
330
+ class Raw < Type
331
+ sig { params(str: String).void }
332
+ def initialize(str); end
333
+
334
+ sig { returns(String) }
335
+ attr_reader :str
336
+
337
+ sig { params(other: Object).returns(T::Boolean) }
338
+ def ==(other); end
339
+
340
+ sig { override.returns(String) }
341
+ def generate_rbi; end
342
+
343
+ sig { override.returns(String) }
344
+ def generate_rbs; end
345
+
346
+ sig { override.returns(String) }
347
+ def describe; end
348
+ end
349
+
350
+ class Nilable < Type
351
+ sig { params(type: TypeLike).void }
352
+ def initialize(type); end
353
+
354
+ sig { params(other: Object).returns(T::Boolean) }
355
+ def ==(other); end
356
+
357
+ sig { returns(Type) }
358
+ attr_reader :type
359
+
360
+ sig { override.returns(String) }
361
+ def generate_rbi; end
362
+
363
+ sig { override.returns(String) }
364
+ def generate_rbs; end
365
+
366
+ sig { override.returns(String) }
367
+ def describe; end
368
+ end
369
+
370
+ class Union < Type
371
+ sig { params(types: T::Array[TypeLike]).void }
372
+ def initialize(types); end
373
+
374
+ sig { params(other: Object).returns(T::Boolean) }
375
+ def ==(other); end
376
+
377
+ sig { returns(T::Array[Type]) }
378
+ attr_reader :types
379
+
380
+ sig { override.returns(String) }
381
+ def generate_rbi; end
382
+
383
+ sig { override.returns(String) }
384
+ def generate_rbs; end
385
+
386
+ sig { override.returns(String) }
387
+ def describe; end
388
+ end
389
+
390
+ class Intersection < Type
391
+ sig { params(types: T::Array[TypeLike]).void }
392
+ def initialize(types); end
393
+
394
+ sig { params(other: Object).returns(T::Boolean) }
395
+ def ==(other); end
396
+
397
+ sig { returns(T::Array[Type]) }
398
+ attr_reader :types
399
+
400
+ sig { override.returns(String) }
401
+ def generate_rbi; end
402
+
403
+ sig { override.returns(String) }
404
+ def generate_rbs; end
405
+
406
+ sig { override.returns(String) }
407
+ def describe; end
408
+ end
409
+
410
+ class Tuple < Type
411
+ sig { params(types: T::Array[TypeLike]).void }
412
+ def initialize(types); end
413
+
414
+ sig { params(other: Object).returns(T::Boolean) }
415
+ def ==(other); end
416
+
417
+ sig { returns(T::Array[Type]) }
418
+ attr_reader :types
419
+
420
+ sig { override.returns(String) }
421
+ def generate_rbi; end
422
+
423
+ sig { override.returns(String) }
424
+ def generate_rbs; end
425
+
426
+ sig { override.returns(String) }
427
+ def describe; end
428
+ end
429
+
430
+ class Generic < Type
431
+ sig { params(type: TypeLike, type_params: T::Array[TypeLike]).void }
432
+ def initialize(type, type_params); end
433
+
434
+ sig { params(other: Object).returns(T::Boolean) }
435
+ def ==(other); end
436
+
437
+ sig { returns(Type) }
438
+ attr_reader :type
439
+
440
+ sig { returns(T::Array[Type]) }
441
+ attr_reader :type_params
442
+
443
+ sig { override.returns(String) }
444
+ def generate_rbi; end
445
+
446
+ sig { override.returns(String) }
447
+ def generate_rbs; end
448
+
449
+ sig { override.returns(String) }
450
+ def describe; end
451
+ end
452
+
453
+ class SingleElementCollection < Type
454
+ abstract!
455
+
456
+ sig { params(element: TypeLike).void }
457
+ def initialize(element); end
458
+
459
+ sig { returns(Type) }
460
+ attr_reader :element
461
+
462
+ sig { abstract.returns(String) }
463
+ def collection_name; end
464
+
465
+ sig { override.returns(String) }
466
+ def generate_rbi; end
467
+
468
+ sig { override.returns(String) }
469
+ def generate_rbs; end
470
+
471
+ sig { override.returns(String) }
472
+ def describe; end
473
+ end
474
+
475
+ class Array < SingleElementCollection
476
+ sig { override.returns(String) }
477
+ def collection_name; end
478
+
479
+ sig { params(other: Object).returns(T::Boolean) }
480
+ def ==(other); end
481
+ end
482
+
483
+ class Set < SingleElementCollection
484
+ sig { override.returns(String) }
485
+ def collection_name; end
486
+
487
+ sig { params(other: Object).returns(T::Boolean) }
488
+ def ==(other); end
489
+ end
490
+
491
+ class Range < SingleElementCollection
492
+ sig { override.returns(String) }
493
+ def collection_name; end
494
+
495
+ sig { params(other: Object).returns(T::Boolean) }
496
+ def ==(other); end
497
+ end
498
+
499
+ class Enumerable < SingleElementCollection
500
+ sig { override.returns(String) }
501
+ def collection_name; end
502
+
503
+ sig { params(other: Object).returns(T::Boolean) }
504
+ def ==(other); end
505
+ end
506
+
507
+ class Enumerator < SingleElementCollection
508
+ sig { override.returns(String) }
509
+ def collection_name; end
510
+
511
+ sig { params(other: Object).returns(T::Boolean) }
512
+ def ==(other); end
513
+ end
514
+
515
+ class Hash < Type
516
+ sig { params(key: TypeLike, value: TypeLike).void }
517
+ def initialize(key, value); end
518
+
519
+ sig { params(other: Object).returns(T::Boolean) }
520
+ def ==(other); end
521
+
522
+ sig { returns(Type) }
523
+ attr_reader :key
524
+
525
+ sig { returns(Type) }
526
+ attr_reader :value
527
+
528
+ sig { override.returns(String) }
529
+ def generate_rbi; end
530
+
531
+ sig { override.returns(String) }
532
+ def generate_rbs; end
533
+
534
+ sig { override.returns(String) }
535
+ def describe; end
536
+ end
537
+
538
+ class Record < Type
539
+ sig { params(keys_to_types: T::Hash[Symbol, TypeLike]).void }
540
+ def initialize(keys_to_types); end
541
+
542
+ sig { params(other: Object).returns(T::Boolean) }
543
+ def ==(other); end
544
+
545
+ sig { returns(T::Hash[Symbol, Type]) }
546
+ attr_reader :keys_to_types
547
+
548
+ sig { override.returns(String) }
549
+ def generate_rbi; end
550
+
551
+ sig { override.returns(String) }
552
+ def generate_rbs; end
553
+
554
+ sig { override.returns(String) }
555
+ def describe; end
556
+ end
557
+
558
+ class Class < Type
559
+ sig { params(type: TypeLike).void }
560
+ def initialize(type); end
561
+
562
+ sig { params(other: Object).returns(T::Boolean) }
563
+ def ==(other); end
564
+
565
+ sig { returns(Type) }
566
+ attr_reader :type
567
+
568
+ sig { override.returns(String) }
569
+ def generate_rbi; end
570
+
571
+ sig { override.returns(String) }
572
+ def generate_rbs; end
573
+
574
+ sig { override.returns(String) }
575
+ def describe; end
576
+ end
577
+
578
+ class Boolean < Type
579
+ sig { params(other: Object).returns(T::Boolean) }
580
+ def ==(other); end
581
+
582
+ sig { override.returns(String) }
583
+ def generate_rbi; end
584
+
585
+ sig { override.returns(String) }
586
+ def generate_rbs; end
587
+
588
+ sig { override.returns(String) }
589
+ def describe; end
590
+ end
591
+
592
+ class Self < Type
593
+ sig { params(other: Object).returns(T::Boolean) }
594
+ def ==(other); end
595
+
596
+ sig { override.returns(String) }
597
+ def generate_rbi; end
598
+
599
+ sig { override.returns(String) }
600
+ def generate_rbs; end
601
+
602
+ sig { override.returns(String) }
603
+ def describe; end
604
+ end
605
+
606
+ class Untyped < Type
607
+ sig { params(other: Object).returns(T::Boolean) }
608
+ def ==(other); end
609
+
610
+ sig { override.returns(String) }
611
+ def generate_rbi; end
612
+
613
+ sig { override.returns(String) }
614
+ def generate_rbs; end
615
+
616
+ sig { override.returns(String) }
617
+ def describe; end
618
+ end
619
+
620
+ class Proc < Type
621
+ class Parameter
622
+ extend T::Sig
623
+
624
+ sig { params(name: String, type: TypeLike, default: T.nilable(String)).void }
625
+ def initialize(name, type, default = nil); end
626
+
627
+ sig { returns(String) }
628
+ attr_reader :name
629
+
630
+ sig { returns(Type) }
631
+ attr_reader :type
632
+
633
+ sig { returns(T.nilable(String)) }
634
+ attr_reader :default
635
+
636
+ sig { params(other: Object).returns(T::Boolean) }
637
+ def ==(other); end
638
+ end
639
+
640
+ sig { params(parameters: T::Array[Parameter], return_type: T.nilable(TypeLike)).void }
641
+ def initialize(parameters, return_type); end
642
+
643
+ sig { params(other: Object).returns(T::Boolean) }
644
+ def ==(other); end
645
+
646
+ sig { returns(T::Array[Parameter]) }
647
+ attr_reader :parameters
648
+
649
+ sig { returns(T.nilable(Type)) }
650
+ attr_reader :return_type
651
+
652
+ sig { override.returns(String) }
653
+ def generate_rbi; end
654
+
655
+ sig { override.returns(String) }
656
+ def generate_rbs; end
657
+
658
+ sig { override.returns(String) }
659
+ def describe; end
660
+ end
661
+ end
662
+
663
+ module Conversion
664
+ class Converter
665
+ abstract!
666
+
667
+ extend T::Sig
668
+ extend T::Helpers
669
+
670
+ sig { returns(T.untyped) }
671
+ def initialize; end
672
+
673
+ sig { returns(T::Array[[String, TypedObject]]) }
674
+ attr_reader :warnings
675
+
676
+ sig { params(msg: String, node: RbiGenerator::RbiObject).void }
677
+ def add_warning(msg, node); end
678
+ end
679
+
680
+ class RbiToRbs < Converter
681
+ extend T::Sig
682
+
683
+ sig { params(rbs_gen: RbsGenerator).void }
684
+ def initialize(rbs_gen); end
685
+
686
+ sig { returns(RbsGenerator) }
687
+ attr_reader :rbs_gen
688
+
689
+ sig { params(from: RbiGenerator::Namespace, to: RbsGenerator::Namespace).void }
690
+ def convert_all(from, to); end
691
+
692
+ sig { params(node: RbiGenerator::RbiObject, new_parent: RbsGenerator::Namespace).void }
693
+ def convert_object(node, new_parent); end
694
+ end
695
+ end
696
+
697
+ class RbiGenerator < Generator
698
+ Options = Parlour::Options
699
+
700
+ sig { params(hash: T.untyped).returns(T.untyped) }
701
+ def initialize(**hash); end
702
+
703
+ sig { returns(RbiGenerator::Namespace) }
704
+ attr_reader :root
705
+
706
+ sig { overridable.params(strictness: String).returns(String) }
707
+ def rbi(strictness = 'strong'); end
708
+
709
+ class Arbitrary < RbiObject
710
+ sig { params(generator: Generator, code: String, block: T.nilable(T.proc.params(x: Arbitrary).void)).void }
711
+ def initialize(generator, code: '', &block); end
712
+
713
+ sig { returns(String) }
714
+ attr_accessor :code
715
+
716
+ sig { params(other: Object).returns(T::Boolean) }
717
+ def ==(other); end
718
+
719
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
720
+ def generate_rbi(indent_level, options); end
721
+
722
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
723
+ def mergeable?(others); end
724
+
725
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
726
+ def merge_into_self(others); end
727
+
728
+ sig { override.returns(String) }
729
+ def describe; end
730
+
731
+ sig { override.void }
732
+ def generalize_from_rbi!; end
733
+ end
734
+
735
+ class Attribute < Method
736
+ sig do
737
+ params(
738
+ generator: Generator,
739
+ name: String,
740
+ kind: Symbol,
741
+ type: Types::TypeLike,
742
+ class_attribute: T::Boolean,
743
+ block: T.nilable(T.proc.params(x: Attribute).void)
744
+ ).void
745
+ end
746
+ def initialize(generator, name, kind, type, class_attribute: false, &block); end
747
+
748
+ sig { returns(Symbol) }
749
+ attr_reader :kind
750
+
751
+ sig { returns(T::Boolean) }
752
+ attr_reader :class_attribute
753
+
754
+ sig { returns(Types::TypeLike) }
755
+ attr_reader :type
756
+
757
+ sig { override.params(other: Object).returns(T::Boolean) }
758
+ def ==(other); end
759
+
760
+ sig { override.void }
761
+ def generalize_from_rbi!; end
762
+
763
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
764
+ def generate_definition(indent_level, options); end
765
+ end
766
+
767
+ class ClassNamespace < Namespace
768
+ extend T::Sig
769
+
770
+ sig do
771
+ params(
772
+ generator: Generator,
773
+ name: String,
774
+ final: T::Boolean,
775
+ sealed: T::Boolean,
776
+ superclass: T.nilable(String),
777
+ abstract: T::Boolean,
778
+ block: T.nilable(T.proc.params(x: ClassNamespace).void)
779
+ ).void
780
+ end
781
+ def initialize(generator, name, final, sealed, superclass, abstract, &block); end
782
+
783
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
784
+ def generate_rbi(indent_level, options); end
785
+
786
+ sig { returns(T.nilable(String)) }
787
+ attr_reader :superclass
788
+
789
+ sig { returns(T::Boolean) }
790
+ attr_reader :abstract
791
+
792
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
793
+ def mergeable?(others); end
794
+
795
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
796
+ def merge_into_self(others); end
797
+
798
+ sig { override.returns(String) }
799
+ def describe; end
800
+
801
+ sig { override.void }
802
+ def generalize_from_rbi!; end
803
+ end
804
+
805
+ class Constant < RbiObject
806
+ sig do
807
+ params(
808
+ generator: Generator,
809
+ name: String,
810
+ value: Types::TypeLike,
811
+ eigen_constant: T::Boolean,
812
+ block: T.nilable(T.proc.params(x: Constant).void)
813
+ ).void
814
+ end
815
+ def initialize(generator, name: '', value: '', eigen_constant: false, &block); end
816
+
817
+ sig { returns(Types::TypeLike) }
818
+ attr_reader :value
819
+
820
+ sig { returns(T.untyped) }
821
+ attr_reader :eigen_constant
822
+
823
+ sig { params(other: Object).returns(T::Boolean) }
824
+ def ==(other); end
825
+
826
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
827
+ def generate_rbi(indent_level, options); end
828
+
829
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
830
+ def mergeable?(others); end
831
+
832
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
833
+ def merge_into_self(others); end
834
+
835
+ sig { override.returns(String) }
836
+ def describe; end
837
+
838
+ sig { override.void }
839
+ def generalize_from_rbi!; end
840
+ end
841
+
842
+ class EnumClassNamespace < ClassNamespace
843
+ extend T::Sig
844
+
845
+ sig do
846
+ params(
847
+ generator: Generator,
848
+ name: String,
849
+ final: T::Boolean,
850
+ sealed: T::Boolean,
851
+ enums: T::Array[T.any([String, String], String)],
852
+ abstract: T::Boolean,
853
+ block: T.nilable(T.proc.params(x: EnumClassNamespace).void)
854
+ ).void
855
+ end
856
+ def initialize(generator, name, final, sealed, enums, abstract, &block); end
857
+
858
+ sig { returns(T::Array[T.any([String, String], String)]) }
859
+ attr_reader :enums
860
+
861
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
862
+ def generate_body(indent_level, options); end
863
+
864
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
865
+ def mergeable?(others); end
866
+
867
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
868
+ def merge_into_self(others); end
869
+
870
+ sig { override.void }
871
+ def generalize_from_rbi!; end
872
+ end
873
+
874
+ class Extend < RbiObject
875
+ sig { params(generator: Generator, name: String, block: T.nilable(T.proc.params(x: Extend).void)).void }
876
+ def initialize(generator, name: '', &block); end
877
+
878
+ sig { params(other: Object).returns(T::Boolean) }
879
+ def ==(other); end
880
+
881
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
882
+ def generate_rbi(indent_level, options); end
883
+
884
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
885
+ def mergeable?(others); end
886
+
887
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
888
+ def merge_into_self(others); end
889
+
890
+ sig { override.returns(String) }
891
+ def describe; end
892
+
893
+ sig { override.void }
894
+ def generalize_from_rbi!; end
895
+ end
896
+
897
+ class Include < RbiObject
898
+ sig { params(generator: Generator, name: String, block: T.nilable(T.proc.params(x: Include).void)).void }
899
+ def initialize(generator, name: '', &block); end
900
+
901
+ sig { params(other: Object).returns(T::Boolean) }
902
+ def ==(other); end
903
+
904
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
905
+ def generate_rbi(indent_level, options); end
906
+
907
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
908
+ def mergeable?(others); end
909
+
910
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
911
+ def merge_into_self(others); end
912
+
913
+ sig { override.returns(String) }
914
+ def describe; end
915
+
916
+ sig { override.void }
917
+ def generalize_from_rbi!; end
918
+ end
919
+
920
+ class Method < RbiObject
921
+ extend T::Sig
922
+
923
+ sig do
924
+ params(
925
+ generator: Generator,
926
+ name: String,
927
+ parameters: T::Array[Parameter],
928
+ return_type: T.nilable(Types::TypeLike),
929
+ abstract: T::Boolean,
930
+ implementation: T::Boolean,
931
+ override: T::Boolean,
932
+ overridable: T::Boolean,
933
+ class_method: T::Boolean,
934
+ final: T::Boolean,
935
+ type_parameters: T.nilable(T::Array[Symbol]),
936
+ block: T.nilable(T.proc.params(x: Method).void)
937
+ ).void
938
+ end
939
+ def initialize(generator, name, parameters, return_type = nil, abstract: false, implementation: false, override: false, overridable: false, class_method: false, final: false, type_parameters: nil, &block); end
940
+
941
+ sig { overridable.params(other: Object).returns(T::Boolean) }
942
+ def ==(other); end
943
+
944
+ sig { returns(T::Array[Parameter]) }
945
+ attr_reader :parameters
946
+
947
+ sig { returns(T.nilable(Types::TypeLike)) }
948
+ attr_reader :return_type
949
+
950
+ sig { returns(T::Boolean) }
951
+ attr_reader :abstract
952
+
953
+ sig { returns(T::Boolean) }
954
+ attr_reader :implementation
955
+
956
+ sig { returns(T::Boolean) }
957
+ attr_reader :override
958
+
959
+ sig { returns(T::Boolean) }
960
+ attr_reader :overridable
961
+
962
+ sig { returns(T::Boolean) }
963
+ attr_reader :class_method
964
+
965
+ sig { returns(T::Boolean) }
966
+ attr_reader :final
967
+
968
+ sig { returns(T::Array[Symbol]) }
969
+ attr_reader :type_parameters
970
+
971
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
972
+ def generate_rbi(indent_level, options); end
973
+
974
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
975
+ def mergeable?(others); end
976
+
977
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
978
+ def merge_into_self(others); end
979
+
980
+ sig { override.returns(String) }
981
+ def describe; end
982
+
983
+ sig { override.void }
984
+ def generalize_from_rbi!; end
985
+
986
+ sig { overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
987
+ def generate_definition(indent_level, options); end
988
+
989
+ sig { returns(String) }
990
+ def qualifiers; end
991
+ end
992
+
993
+ class ModuleNamespace < Namespace
994
+ extend T::Sig
995
+
996
+ sig do
997
+ params(
998
+ generator: Generator,
999
+ name: String,
1000
+ final: T::Boolean,
1001
+ sealed: T::Boolean,
1002
+ interface: T::Boolean,
1003
+ abstract: T::Boolean,
1004
+ block: T.nilable(T.proc.params(x: ClassNamespace).void)
1005
+ ).void
1006
+ end
1007
+ def initialize(generator, name, final, sealed, interface, abstract, &block); end
1008
+
1009
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1010
+ def generate_rbi(indent_level, options); end
1011
+
1012
+ sig { returns(T::Boolean) }
1013
+ attr_reader :interface
1014
+
1015
+ sig { returns(T::Boolean) }
1016
+ attr_reader :abstract
1017
+
1018
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
1019
+ def mergeable?(others); end
1020
+
1021
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
1022
+ def merge_into_self(others); end
1023
+
1024
+ sig { override.returns(String) }
1025
+ def describe; end
1026
+
1027
+ sig { override.void }
1028
+ def generalize_from_rbi!; end
1029
+ end
1030
+
1031
+ class Namespace < RbiObject
1032
+ extend T::Sig
1033
+
1034
+ sig { override.overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1035
+ def generate_rbi(indent_level, options); end
1036
+
1037
+ sig do
1038
+ params(
1039
+ generator: Generator,
1040
+ name: T.nilable(String),
1041
+ final: T::Boolean,
1042
+ sealed: T::Boolean,
1043
+ block: T.nilable(T.proc.params(x: Namespace).void)
1044
+ ).void
1045
+ end
1046
+ def initialize(generator, name = nil, final = false, sealed = false, &block); end
1047
+
1048
+ sig { returns(T::Boolean) }
1049
+ attr_reader :final
1050
+
1051
+ sig { returns(T::Boolean) }
1052
+ attr_reader :sealed
1053
+
1054
+ sig { returns(T::Array[RbiObject]) }
1055
+ attr_reader :children
1056
+
1057
+ sig { returns(T::Array[RbiGenerator::Extend]) }
1058
+ def extends; end
1059
+
1060
+ sig { returns(T::Array[RbiGenerator::Include]) }
1061
+ def includes; end
1062
+
1063
+ sig { returns(T::Array[RbiGenerator::TypeAlias]) }
1064
+ def aliases; end
1065
+
1066
+ sig { returns(T::Array[RbiGenerator::Constant]) }
1067
+ def constants; end
1068
+
1069
+ sig { params(constant: Module, block: T.proc.params(x: Namespace).void).void }
1070
+ def path(constant, &block); end
1071
+
1072
+ sig { params(comment: T.any(String, T::Array[String])).void }
1073
+ def add_comment_to_next_child(comment); end
1074
+
1075
+ sig do
1076
+ params(
1077
+ name: String,
1078
+ final: T::Boolean,
1079
+ sealed: T::Boolean,
1080
+ superclass: T.nilable(String),
1081
+ abstract: T::Boolean,
1082
+ block: T.nilable(T.proc.params(x: ClassNamespace).void)
1083
+ ).returns(ClassNamespace)
1084
+ end
1085
+ def create_class(name, final: false, sealed: false, superclass: nil, abstract: false, &block); end
1086
+
1087
+ sig do
1088
+ params(
1089
+ name: String,
1090
+ final: T::Boolean,
1091
+ sealed: T::Boolean,
1092
+ enums: T.nilable(T::Array[T.any([String, String], String)]),
1093
+ abstract: T::Boolean,
1094
+ block: T.nilable(T.proc.params(x: EnumClassNamespace).void)
1095
+ ).returns(EnumClassNamespace)
1096
+ end
1097
+ def create_enum_class(name, final: false, sealed: false, enums: nil, abstract: false, &block); end
1098
+
1099
+ sig do
1100
+ params(
1101
+ name: String,
1102
+ final: T::Boolean,
1103
+ sealed: T::Boolean,
1104
+ props: T.nilable(T::Array[StructProp]),
1105
+ abstract: T::Boolean,
1106
+ block: T.nilable(T.proc.params(x: StructClassNamespace).void)
1107
+ ).returns(StructClassNamespace)
1108
+ end
1109
+ def create_struct_class(name, final: false, sealed: false, props: nil, abstract: false, &block); end
1110
+
1111
+ sig do
1112
+ params(
1113
+ name: String,
1114
+ final: T::Boolean,
1115
+ sealed: T::Boolean,
1116
+ interface: T::Boolean,
1117
+ abstract: T::Boolean,
1118
+ block: T.nilable(T.proc.params(x: ClassNamespace).void)
1119
+ ).returns(ModuleNamespace)
1120
+ end
1121
+ def create_module(name, final: false, sealed: false, interface: false, abstract: false, &block); end
1122
+
1123
+ sig do
1124
+ params(
1125
+ name: String,
1126
+ parameters: T.nilable(T::Array[Parameter]),
1127
+ return_type: T.nilable(Types::TypeLike),
1128
+ returns: T.nilable(Types::TypeLike),
1129
+ abstract: T::Boolean,
1130
+ implementation: T::Boolean,
1131
+ override: T::Boolean,
1132
+ overridable: T::Boolean,
1133
+ class_method: T::Boolean,
1134
+ final: T::Boolean,
1135
+ type_parameters: T.nilable(T::Array[Symbol]),
1136
+ block: T.nilable(T.proc.params(x: Method).void)
1137
+ ).returns(Method)
1138
+ end
1139
+ def create_method(name, parameters: nil, return_type: nil, returns: nil, abstract: false, implementation: false, override: false, overridable: false, class_method: false, final: false, type_parameters: nil, &block); end
1140
+
1141
+ sig do
1142
+ params(
1143
+ name: String,
1144
+ kind: Symbol,
1145
+ type: Types::TypeLike,
1146
+ class_attribute: T::Boolean,
1147
+ block: T.nilable(T.proc.params(x: Attribute).void)
1148
+ ).returns(Attribute)
1149
+ end
1150
+ def create_attribute(name, kind:, type:, class_attribute: false, &block); end
1151
+
1152
+ sig do
1153
+ params(
1154
+ name: String,
1155
+ type: Types::TypeLike,
1156
+ class_attribute: T::Boolean,
1157
+ block: T.nilable(T.proc.params(x: Attribute).void)
1158
+ ).returns(Attribute)
1159
+ end
1160
+ def create_attr_reader(name, type:, class_attribute: false, &block); end
1161
+
1162
+ sig do
1163
+ params(
1164
+ name: String,
1165
+ type: Types::TypeLike,
1166
+ class_attribute: T::Boolean,
1167
+ block: T.nilable(T.proc.params(x: Attribute).void)
1168
+ ).returns(Attribute)
1169
+ end
1170
+ def create_attr_writer(name, type:, class_attribute: false, &block); end
1171
+
1172
+ sig do
1173
+ params(
1174
+ name: String,
1175
+ type: Types::TypeLike,
1176
+ class_attribute: T::Boolean,
1177
+ block: T.nilable(T.proc.params(x: Attribute).void)
1178
+ ).returns(Attribute)
1179
+ end
1180
+ def create_attr_accessor(name, type:, class_attribute: false, &block); end
1181
+
1182
+ sig { params(code: T.untyped, block: T.untyped).returns(T.untyped) }
1183
+ def create_arbitrary(code:, &block); end
1184
+
1185
+ sig { params(name: String, block: T.nilable(T.proc.params(x: Extend).void)).returns(RbiGenerator::Extend) }
1186
+ def create_extend(name, &block); end
1187
+
1188
+ sig { params(extendables: T::Array[String]).returns(T::Array[Extend]) }
1189
+ def create_extends(extendables); end
1190
+
1191
+ sig { params(name: String, block: T.nilable(T.proc.params(x: Include).void)).returns(Include) }
1192
+ def create_include(name, &block); end
1193
+
1194
+ sig { params(includables: T::Array[String]).returns(T::Array[Include]) }
1195
+ def create_includes(includables); end
1196
+
1197
+ sig do
1198
+ params(
1199
+ name: String,
1200
+ value: String,
1201
+ eigen_constant: T::Boolean,
1202
+ block: T.nilable(T.proc.params(x: Constant).void)
1203
+ ).returns(Constant)
1204
+ end
1205
+ def create_constant(name, value:, eigen_constant: false, &block); end
1206
+
1207
+ sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: TypeAlias).void)).returns(TypeAlias) }
1208
+ def create_type_alias(name, type:, &block); end
1209
+
1210
+ sig { override.overridable.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
1211
+ def mergeable?(others); end
1212
+
1213
+ sig { override.overridable.params(others: T::Array[RbiGenerator::RbiObject]).void }
1214
+ def merge_into_self(others); end
1215
+
1216
+ sig { override.overridable.returns(String) }
1217
+ def describe; end
1218
+
1219
+ sig { override.void }
1220
+ def generalize_from_rbi!; end
1221
+
1222
+ sig { overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1223
+ def generate_body(indent_level, options); end
1224
+
1225
+ sig { params(object: RbiObject).void }
1226
+ def move_next_comments(object); end
1227
+ end
1228
+
1229
+ class Parameter
1230
+ extend T::Sig
1231
+ PREFIXES = T.let({
1232
+ normal: '',
1233
+ splat: '*',
1234
+ double_splat: '**',
1235
+ block: '&'
1236
+ }.freeze, T::Hash[Symbol, String])
1237
+
1238
+ sig { params(name: String, type: T.nilable(Types::TypeLike), default: T.nilable(String)).void }
1239
+ def initialize(name, type: nil, default: nil); end
1240
+
1241
+ sig { params(other: Object).returns(T::Boolean) }
1242
+ def ==(other); end
1243
+
1244
+ sig { returns(String) }
1245
+ attr_reader :name
1246
+
1247
+ sig { returns(String) }
1248
+ def name_without_kind; end
1249
+
1250
+ sig { returns(Types::TypeLike) }
1251
+ attr_reader :type
1252
+
1253
+ sig { returns(T.nilable(String)) }
1254
+ attr_reader :default
1255
+
1256
+ sig { returns(Symbol) }
1257
+ attr_reader :kind
1258
+
1259
+ sig { returns(String) }
1260
+ def to_def_param; end
1261
+
1262
+ sig { returns(String) }
1263
+ def to_sig_param; end
1264
+
1265
+ sig { void }
1266
+ def generalize_from_rbi!; end
1267
+ end
1268
+
1269
+ class RbiObject < TypedObject
1270
+ abstract!
1271
+
1272
+ sig { params(generator: Generator, name: String).void }
1273
+ def initialize(generator, name); end
1274
+
1275
+ sig { returns(Generator) }
1276
+ attr_reader :generator
1277
+
1278
+ sig { abstract.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1279
+ def generate_rbi(indent_level, options); end
1280
+
1281
+ sig { abstract.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
1282
+ def mergeable?(others); end
1283
+
1284
+ sig { abstract.params(others: T::Array[RbiGenerator::RbiObject]).void }
1285
+ def merge_into_self(others); end
1286
+
1287
+ sig { override.overridable.returns(String) }
1288
+ def describe; end
1289
+
1290
+ sig { abstract.void }
1291
+ def generalize_from_rbi!; end
1292
+ end
1293
+
1294
+ class StructClassNamespace < ClassNamespace
1295
+ extend T::Sig
1296
+
1297
+ sig do
1298
+ params(
1299
+ generator: Generator,
1300
+ name: String,
1301
+ final: T::Boolean,
1302
+ sealed: T::Boolean,
1303
+ props: T::Array[StructProp],
1304
+ abstract: T::Boolean,
1305
+ block: T.nilable(T.proc.params(x: StructClassNamespace).void)
1306
+ ).void
1307
+ end
1308
+ def initialize(generator, name, final, sealed, props, abstract, &block); end
1309
+
1310
+ sig { returns(T::Array[StructProp]) }
1311
+ attr_reader :props
1312
+
1313
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1314
+ def generate_body(indent_level, options); end
1315
+
1316
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
1317
+ def mergeable?(others); end
1318
+
1319
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
1320
+ def merge_into_self(others); end
1321
+
1322
+ sig { override.void }
1323
+ def generalize_from_rbi!; end
1324
+ end
1325
+
1326
+ class StructProp
1327
+ extend T::Sig
1328
+ EXTRA_PROPERTIES = T.let(%i{
1329
+ optional enum dont_store foreign default factory immutable array override redaction
1330
+ }, T::Array[Symbol])
1331
+
1332
+ sig do
1333
+ params(
1334
+ name: String,
1335
+ type: Types::TypeLike,
1336
+ optional: T.nilable(T.any(T::Boolean, Symbol)),
1337
+ enum: T.nilable(String),
1338
+ dont_store: T.nilable(T::Boolean),
1339
+ foreign: T.nilable(String),
1340
+ default: T.nilable(String),
1341
+ factory: T.nilable(String),
1342
+ immutable: T.nilable(T::Boolean),
1343
+ array: T.nilable(String),
1344
+ override: T.nilable(T::Boolean),
1345
+ redaction: T.nilable(String)
1346
+ ).void
1347
+ end
1348
+ def initialize(name, type, optional: nil, enum: nil, dont_store: nil, foreign: nil, default: nil, factory: nil, immutable: nil, array: nil, override: nil, redaction: nil); end
1349
+
1350
+ sig { params(other: Object).returns(T::Boolean) }
1351
+ def ==(other); end
1352
+
1353
+ sig { returns(String) }
1354
+ attr_reader :name
1355
+
1356
+ sig { returns(Types::TypeLike) }
1357
+ attr_reader :type
1358
+
1359
+ sig { returns(T.nilable(T.any(T::Boolean, Symbol))) }
1360
+ attr_reader :optional
1361
+
1362
+ sig { returns(T.nilable(String)) }
1363
+ attr_reader :enum
1364
+
1365
+ sig { returns(T.nilable(T::Boolean)) }
1366
+ attr_reader :dont_store
1367
+
1368
+ sig { returns(T.nilable(String)) }
1369
+ attr_reader :foreign
1370
+
1371
+ sig { returns(T.nilable(String)) }
1372
+ attr_reader :default
1373
+
1374
+ sig { returns(T.nilable(String)) }
1375
+ attr_reader :factory
1376
+
1377
+ sig { returns(T.nilable(T::Boolean)) }
1378
+ attr_reader :immutable
1379
+
1380
+ sig { returns(T.nilable(String)) }
1381
+ attr_reader :array
1382
+
1383
+ sig { returns(T.nilable(T::Boolean)) }
1384
+ attr_reader :override
1385
+
1386
+ sig { returns(T.nilable(String)) }
1387
+ attr_reader :redaction
1388
+
1389
+ sig { returns(String) }
1390
+ def to_prop_call; end
1391
+
1392
+ sig { void }
1393
+ def generalize_from_rbi!; end
1394
+ end
1395
+
1396
+ class TypeAlias < RbiObject
1397
+ sig do
1398
+ params(
1399
+ generator: Generator,
1400
+ name: String,
1401
+ type: Types::TypeLike,
1402
+ block: T.nilable(T.proc.params(x: TypeAlias).void)
1403
+ ).void
1404
+ end
1405
+ def initialize(generator, name:, type:, &block); end
1406
+
1407
+ sig { returns(Types::TypeLike) }
1408
+ attr_reader :type
1409
+
1410
+ sig { params(other: Object).returns(T::Boolean) }
1411
+ def ==(other); end
1412
+
1413
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1414
+ def generate_rbi(indent_level, options); end
1415
+
1416
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).returns(T::Boolean) }
1417
+ def mergeable?(others); end
1418
+
1419
+ sig { override.params(others: T::Array[RbiGenerator::RbiObject]).void }
1420
+ def merge_into_self(others); end
1421
+
1422
+ sig { override.returns(String) }
1423
+ def describe; end
1424
+
1425
+ sig { override.void }
1426
+ def generalize_from_rbi!; end
1427
+ end
1428
+ end
1429
+
1430
+ class RbsGenerator < Generator
1431
+ sig { params(hash: T.untyped).returns(T.untyped) }
1432
+ def initialize(**hash); end
1433
+
1434
+ sig { returns(RbsGenerator::Namespace) }
1435
+ attr_reader :root
1436
+
1437
+ sig { overridable.returns(String) }
1438
+ def rbs; end
1439
+
1440
+ class Arbitrary < RbsObject
1441
+ sig { params(generator: Generator, code: String, block: T.nilable(T.proc.params(x: Arbitrary).void)).void }
1442
+ def initialize(generator, code: '', &block); end
1443
+
1444
+ sig { returns(String) }
1445
+ attr_accessor :code
1446
+
1447
+ sig { params(other: Object).returns(T::Boolean) }
1448
+ def ==(other); end
1449
+
1450
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1451
+ def generate_rbs(indent_level, options); end
1452
+
1453
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1454
+ def mergeable?(others); end
1455
+
1456
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1457
+ def merge_into_self(others); end
1458
+
1459
+ sig { override.returns(String) }
1460
+ def describe; end
1461
+ end
1462
+
1463
+ class Attribute < RbsGenerator::Method
1464
+ extend T::Sig
1465
+
1466
+ sig do
1467
+ params(
1468
+ generator: Generator,
1469
+ name: String,
1470
+ kind: Symbol,
1471
+ type: Types::TypeLike,
1472
+ block: T.nilable(T.proc.params(x: Attribute).void)
1473
+ ).void
1474
+ end
1475
+ def initialize(generator, name, kind, type, &block); end
1476
+
1477
+ sig { returns(Symbol) }
1478
+ attr_reader :kind
1479
+
1480
+ sig { returns(Types::TypeLike) }
1481
+ attr_reader :type
1482
+
1483
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1484
+ def generate_rbs(indent_level, options); end
1485
+
1486
+ sig { override.params(other: Object).returns(T::Boolean) }
1487
+ def ==(other); end
1488
+ end
1489
+
1490
+ class Block
1491
+ extend T::Sig
1492
+
1493
+ sig { params(type: Types::Proc, required: T::Boolean).void }
1494
+ def initialize(type, required); end
1495
+
1496
+ sig { overridable.params(other: Object).returns(T::Boolean) }
1497
+ def ==(other); end
1498
+
1499
+ sig { returns(Types::Proc) }
1500
+ attr_reader :type
1501
+
1502
+ sig { returns(T::Boolean) }
1503
+ attr_reader :required
1504
+
1505
+ sig { params(options: Options).returns(T::Array[String]) }
1506
+ def generate_rbs(options); end
1507
+ end
1508
+
1509
+ class ClassNamespace < Namespace
1510
+ extend T::Sig
1511
+
1512
+ sig do
1513
+ params(
1514
+ generator: Generator,
1515
+ name: String,
1516
+ superclass: T.nilable(Types::TypeLike),
1517
+ block: T.nilable(T.proc.params(x: ClassNamespace).void)
1518
+ ).void
1519
+ end
1520
+ def initialize(generator, name, superclass, &block); end
1521
+
1522
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1523
+ def generate_rbs(indent_level, options); end
1524
+
1525
+ sig { returns(T.nilable(Types::TypeLike)) }
1526
+ attr_reader :superclass
1527
+
1528
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1529
+ def mergeable?(others); end
1530
+
1531
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1532
+ def merge_into_self(others); end
1533
+
1534
+ sig { override.returns(String) }
1535
+ def describe; end
1536
+ end
1537
+
1538
+ class Constant < RbsObject
1539
+ sig do
1540
+ params(
1541
+ generator: Generator,
1542
+ name: String,
1543
+ type: Types::TypeLike,
1544
+ block: T.nilable(T.proc.params(x: Constant).void)
1545
+ ).void
1546
+ end
1547
+ def initialize(generator, name, type:, &block); end
1548
+
1549
+ sig { returns(Types::TypeLike) }
1550
+ attr_reader :type
1551
+
1552
+ sig { params(other: Object).returns(T::Boolean) }
1553
+ def ==(other); end
1554
+
1555
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1556
+ def generate_rbs(indent_level, options); end
1557
+
1558
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1559
+ def mergeable?(others); end
1560
+
1561
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1562
+ def merge_into_self(others); end
1563
+
1564
+ sig { override.returns(String) }
1565
+ def describe; end
1566
+ end
1567
+
1568
+ class Extend < RbsObject
1569
+ sig { params(generator: Generator, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Extend).void)).void }
1570
+ def initialize(generator, type:, &block); end
1571
+
1572
+ sig { params(other: Object).returns(T::Boolean) }
1573
+ def ==(other); end
1574
+
1575
+ sig { returns(Types::TypeLike) }
1576
+ attr_reader :type
1577
+
1578
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1579
+ def generate_rbs(indent_level, options); end
1580
+
1581
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1582
+ def mergeable?(others); end
1583
+
1584
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1585
+ def merge_into_self(others); end
1586
+
1587
+ sig { override.returns(String) }
1588
+ def describe; end
1589
+ end
1590
+
1591
+ class Include < RbsObject
1592
+ sig { params(generator: Generator, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Include).void)).void }
1593
+ def initialize(generator, type:, &block); end
1594
+
1595
+ sig { params(other: Object).returns(T::Boolean) }
1596
+ def ==(other); end
1597
+
1598
+ sig { returns(Types::TypeLike) }
1599
+ attr_reader :type
1600
+
1601
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1602
+ def generate_rbs(indent_level, options); end
1603
+
1604
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1605
+ def mergeable?(others); end
1606
+
1607
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1608
+ def merge_into_self(others); end
1609
+
1610
+ sig { override.returns(String) }
1611
+ def describe; end
1612
+ end
1613
+
1614
+ class InterfaceNamespace < Namespace
1615
+ extend T::Sig
1616
+
1617
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1618
+ def generate_rbs(indent_level, options); end
1619
+
1620
+ sig { override.returns(String) }
1621
+ def describe; end
1622
+ end
1623
+
1624
+ class Method < RbsObject
1625
+ extend T::Sig
1626
+
1627
+ sig do
1628
+ params(
1629
+ generator: Generator,
1630
+ name: String,
1631
+ signatures: T::Array[MethodSignature],
1632
+ class_method: T::Boolean,
1633
+ block: T.nilable(T.proc.params(x: Method).void)
1634
+ ).void
1635
+ end
1636
+ def initialize(generator, name, signatures, class_method: false, &block); end
1637
+
1638
+ sig { overridable.params(other: Object).returns(T::Boolean) }
1639
+ def ==(other); end
1640
+
1641
+ sig { returns(T::Array[MethodSignature]) }
1642
+ attr_reader :signatures
1643
+
1644
+ sig { returns(T::Boolean) }
1645
+ attr_reader :class_method
1646
+
1647
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1648
+ def generate_rbs(indent_level, options); end
1649
+
1650
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1651
+ def mergeable?(others); end
1652
+
1653
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1654
+ def merge_into_self(others); end
1655
+
1656
+ sig { override.returns(String) }
1657
+ def describe; end
1658
+ end
1659
+
1660
+ class MethodSignature
1661
+ extend T::Sig
1662
+
1663
+ sig do
1664
+ params(
1665
+ parameters: T::Array[Parameter],
1666
+ return_type: T.nilable(Types::TypeLike),
1667
+ block: T.nilable(Block),
1668
+ type_parameters: T.nilable(T::Array[Symbol])
1669
+ ).void
1670
+ end
1671
+ def initialize(parameters, return_type = nil, block: nil, type_parameters: nil); end
1672
+
1673
+ sig { overridable.params(other: Object).returns(T::Boolean) }
1674
+ def ==(other); end
1675
+
1676
+ sig { returns(T::Array[Parameter]) }
1677
+ attr_reader :parameters
1678
+
1679
+ sig { returns(T.nilable(Types::TypeLike)) }
1680
+ attr_reader :return_type
1681
+
1682
+ sig { returns(T.nilable(Block)) }
1683
+ attr_reader :block
1684
+
1685
+ sig { returns(T::Array[Symbol]) }
1686
+ attr_reader :type_parameters
1687
+
1688
+ sig { params(options: Options).returns(T::Array[String]) }
1689
+ def generate_rbs(options); end
1690
+ end
1691
+
1692
+ class ModuleNamespace < Namespace
1693
+ extend T::Sig
1694
+
1695
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1696
+ def generate_rbs(indent_level, options); end
1697
+
1698
+ sig { override.returns(String) }
1699
+ def describe; end
1700
+ end
1701
+
1702
+ class Namespace < RbsObject
1703
+ extend T::Sig
1704
+
1705
+ sig { override.overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1706
+ def generate_rbs(indent_level, options); end
1707
+
1708
+ sig { params(generator: Generator, name: T.nilable(String), block: T.nilable(T.proc.params(x: Namespace).void)).void }
1709
+ def initialize(generator, name = nil, &block); end
1710
+
1711
+ sig { returns(T::Array[RbsObject]) }
1712
+ attr_reader :children
1713
+
1714
+ sig { returns(T::Array[RbsGenerator::Extend]) }
1715
+ def extends; end
1716
+
1717
+ sig { returns(T::Array[RbsGenerator::Include]) }
1718
+ def includes; end
1719
+
1720
+ sig { returns(T::Array[RbsGenerator::TypeAlias]) }
1721
+ def aliases; end
1722
+
1723
+ sig { returns(T::Array[RbsGenerator::Constant]) }
1724
+ def constants; end
1725
+
1726
+ sig { params(object: T.untyped, block: T.proc.params(x: Namespace).void).void }
1727
+ def path(object, &block); end
1728
+
1729
+ sig { params(comment: T.any(String, T::Array[String])).void }
1730
+ def add_comment_to_next_child(comment); end
1731
+
1732
+ sig { params(name: String, superclass: T.nilable(Types::TypeLike), block: T.nilable(T.proc.params(x: ClassNamespace).void)).returns(ClassNamespace) }
1733
+ def create_class(name, superclass: nil, &block); end
1734
+
1735
+ sig { params(name: String, block: T.nilable(T.proc.params(x: Namespace).void)).returns(ModuleNamespace) }
1736
+ def create_module(name, &block); end
1737
+
1738
+ sig { params(name: String, block: T.nilable(T.proc.params(x: Namespace).void)).returns(InterfaceNamespace) }
1739
+ def create_interface(name, &block); end
1740
+
1741
+ sig do
1742
+ params(
1743
+ name: String,
1744
+ signatures: T.nilable(T::Array[MethodSignature]),
1745
+ class_method: T::Boolean,
1746
+ block: T.nilable(T.proc.params(x: Method).void)
1747
+ ).returns(Method)
1748
+ end
1749
+ def create_method(name, signatures = nil, class_method: false, &block); end
1750
+
1751
+ sig do
1752
+ params(
1753
+ name: String,
1754
+ kind: Symbol,
1755
+ type: Types::TypeLike,
1756
+ block: T.nilable(T.proc.params(x: Attribute).void)
1757
+ ).returns(Attribute)
1758
+ end
1759
+ def create_attribute(name, kind:, type:, &block); end
1760
+
1761
+ sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Attribute).void)).returns(Attribute) }
1762
+ def create_attr_reader(name, type:, &block); end
1763
+
1764
+ sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Attribute).void)).returns(Attribute) }
1765
+ def create_attr_writer(name, type:, &block); end
1766
+
1767
+ sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Attribute).void)).returns(Attribute) }
1768
+ def create_attr_accessor(name, type:, &block); end
1769
+
1770
+ sig { params(code: T.untyped, block: T.untyped).returns(T.untyped) }
1771
+ def create_arbitrary(code:, &block); end
1772
+
1773
+ sig { params(type: Types::TypeLike, block: T.nilable(T.proc.params(x: Extend).void)).returns(RbsGenerator::Extend) }
1774
+ def create_extend(type, &block); end
1775
+
1776
+ sig { params(extendables: T::Array[Types::TypeLike]).returns(T::Array[Extend]) }
1777
+ def create_extends(extendables); end
1778
+
1779
+ sig { params(type: Types::TypeLike, block: T.nilable(T.proc.params(x: Include).void)).returns(Include) }
1780
+ def create_include(type, &block); end
1781
+
1782
+ sig { params(includables: T::Array[Types::TypeLike]).returns(T::Array[Include]) }
1783
+ def create_includes(includables); end
1784
+
1785
+ sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: Constant).void)).returns(Constant) }
1786
+ def create_constant(name, type:, &block); end
1787
+
1788
+ sig { params(name: String, type: Types::TypeLike, block: T.nilable(T.proc.params(x: TypeAlias).void)).returns(TypeAlias) }
1789
+ def create_type_alias(name, type:, &block); end
1790
+
1791
+ sig { override.overridable.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1792
+ def mergeable?(others); end
1793
+
1794
+ sig { override.overridable.params(others: T::Array[RbsGenerator::RbsObject]).void }
1795
+ def merge_into_self(others); end
1796
+
1797
+ sig { override.overridable.returns(String) }
1798
+ def describe; end
1799
+
1800
+ sig { overridable.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1801
+ def generate_body(indent_level, options); end
1802
+
1803
+ sig { params(object: RbsObject).void }
1804
+ def move_next_comments(object); end
1805
+ end
1806
+
1807
+ class Parameter
1808
+ extend T::Sig
1809
+ RBS_KEYWORDS = [
1810
+ 'type', 'interface', 'out', 'in', 'instance', 'extension', 'top', 'bot',
1811
+ 'self', 'nil', 'void'
1812
+ ]
1813
+ PREFIXES = {
1814
+ normal: '',
1815
+ splat: '*',
1816
+ double_splat: '**',
1817
+ }.freeze
1818
+
1819
+ sig { params(name: String, type: T.nilable(Types::TypeLike), required: T::Boolean).void }
1820
+ def initialize(name, type: nil, required: true); end
1821
+
1822
+ sig { params(other: Object).returns(T::Boolean) }
1823
+ def ==(other); end
1824
+
1825
+ sig { returns(String) }
1826
+ attr_reader :name
1827
+
1828
+ sig { returns(String) }
1829
+ def name_without_kind; end
1830
+
1831
+ sig { returns(Types::TypeLike) }
1832
+ attr_reader :type
1833
+
1834
+ sig { returns(T::Boolean) }
1835
+ attr_reader :required
1836
+
1837
+ sig { returns(Symbol) }
1838
+ attr_reader :kind
1839
+
1840
+ sig { returns(String) }
1841
+ def to_rbs_param; end
1842
+ end
1843
+
1844
+ class RbsObject < TypedObject
1845
+ abstract!
1846
+
1847
+ sig { params(generator: Generator, name: String).void }
1848
+ def initialize(generator, name); end
1849
+
1850
+ sig { returns(Generator) }
1851
+ attr_reader :generator
1852
+
1853
+ sig { abstract.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1854
+ def generate_rbs(indent_level, options); end
1855
+
1856
+ sig { abstract.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1857
+ def mergeable?(others); end
1858
+
1859
+ sig { abstract.params(others: T::Array[RbsGenerator::RbsObject]).void }
1860
+ def merge_into_self(others); end
1861
+
1862
+ sig { override.overridable.returns(String) }
1863
+ def describe; end
1864
+ end
1865
+
1866
+ class TypeAlias < RbsObject
1867
+ sig do
1868
+ params(
1869
+ generator: Generator,
1870
+ name: String,
1871
+ type: Types::TypeLike,
1872
+ block: T.nilable(T.proc.params(x: TypeAlias).void)
1873
+ ).void
1874
+ end
1875
+ def initialize(generator, name:, type:, &block); end
1876
+
1877
+ sig { returns(Types::TypeLike) }
1878
+ attr_reader :type
1879
+
1880
+ sig { params(other: Object).returns(T::Boolean) }
1881
+ def ==(other); end
1882
+
1883
+ sig { override.params(indent_level: Integer, options: Options).returns(T::Array[String]) }
1884
+ def generate_rbs(indent_level, options); end
1885
+
1886
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).returns(T::Boolean) }
1887
+ def mergeable?(others); end
1888
+
1889
+ sig { override.params(others: T::Array[RbsGenerator::RbsObject]).void }
1890
+ def merge_into_self(others); end
1891
+
1892
+ sig { override.returns(String) }
1893
+ def describe; end
1894
+ end
1895
+ end
1896
+ end