sorbet-rails 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codecov.yml +4 -0
- data/.github/ISSUE_TEMPLATE/bug.md +26 -0
- data/.gitignore +5 -0
- data/.travis.yml +26 -7
- data/CONTRIBUTING.md +135 -0
- data/Gemfile +29 -11
- data/README.md +40 -7
- data/lib/sorbet-rails/custom_finder_methods.rb +1 -1
- data/lib/sorbet-rails/model_rbi_formatter.rb +72 -41
- data/lib/sorbet-rails/routes_rbi_formatter.rb +6 -14
- data/lib/sorbet-rails/tasks/rails_rbi.rake +13 -6
- data/rbi/activerecord.rbi +32 -7
- data/sorbet-rails.gemspec +2 -4
- data/spec/bin/install.sh +11 -0
- data/spec/bin/run_all_specs.sh +9 -5
- data/spec/bin/run_spec.sh +33 -0
- data/spec/bin/{reset_test_data.sh → update_test_data.sh} +2 -1
- data/spec/custom_finder_methods_spec.rb +75 -0
- data/spec/model_rbi_formatter_spec.rb +8 -6
- data/spec/rails_helper.rb +32 -5
- data/spec/rake_helper.rb +47 -0
- data/spec/rake_rails_rbi_models_spec.rb +64 -0
- data/spec/rake_rails_rbi_routes_spec.rb +15 -0
- data/spec/support/rails_shared/app/models/wizard.rb +4 -4
- data/spec/support/rails_shared/db/migrate/20190620001234_create_wizards.rb +1 -1
- data/spec/support/rails_shared/db/migrate/20190620003037_create_wands.rb +1 -1
- data/spec/support/rails_shared/db/migrate/20190620003739_create_spell_books.rb +1 -1
- data/spec/support/rails_shared/db/migrate/20190622000000_add_more_column_types_to_wands.rb +5 -3
- data/spec/support/rails_symlinks/app/controllers +1 -0
- data/spec/support/rails_symlinks/app/models +1 -0
- data/spec/support/rails_symlinks/config/routes.rb +5 -0
- data/spec/support/rails_symlinks/db/migrate +1 -0
- data/spec/support/v4.2/.gitignore +17 -0
- data/spec/support/v4.2/Gemfile +31 -0
- data/spec/support/v4.2/README.rdoc +28 -0
- data/spec/support/v4.2/Rakefile +6 -0
- data/spec/support/{5.1.7/lib/tasks → v4.2/app/assets/images}/.keep +0 -0
- data/spec/support/v4.2/app/assets/stylesheets/application.css +15 -0
- data/spec/support/v4.2/app/controllers/application_controller.rb +5 -0
- data/spec/support/{5.1.7/log → v4.2/app/controllers/concerns}/.keep +0 -0
- data/spec/support/v4.2/app/helpers/application_helper.rb +2 -0
- data/spec/support/{5.1.7/test/controllers → v4.2/app/mailers}/.keep +0 -0
- data/spec/support/v4.2/app/models +1 -0
- data/spec/support/v4.2/app/views/layouts/application.html.erb +13 -0
- data/spec/support/{5.1.7 → v4.2}/bin/bundle +0 -0
- data/spec/support/v4.2/bin/rails +4 -0
- data/spec/support/v4.2/bin/rake +4 -0
- data/spec/support/v4.2/bin/setup +29 -0
- data/spec/support/v4.2/config.ru +4 -0
- data/spec/support/v4.2/config/application.rb +35 -0
- data/spec/support/v4.2/config/boot.rb +3 -0
- data/spec/support/v4.2/config/database.yml +25 -0
- data/spec/support/v4.2/config/environment.rb +5 -0
- data/spec/support/v4.2/config/environments/development.rb +28 -0
- data/spec/support/v4.2/config/environments/production.rb +67 -0
- data/spec/support/v4.2/config/environments/test.rb +42 -0
- data/spec/support/{5.1.7 → v4.2}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/support/v4.2/config/initializers/cookies_serializer.rb +3 -0
- data/spec/support/{5.1.7 → v4.2}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/support/{5.1.7 → v4.2}/config/initializers/inflections.rb +0 -0
- data/spec/support/{5.1.7 → v4.2}/config/initializers/mime_types.rb +0 -0
- data/spec/support/v4.2/config/initializers/session_store.rb +3 -0
- data/spec/support/v4.2/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/spec/support/v4.2/config/initializers/wrap_parameters.rb +14 -0
- data/spec/support/v4.2/config/locales/en.yml +23 -0
- data/spec/support/v4.2/config/routes.rb +5 -0
- data/spec/support/v4.2/config/secrets.yml +22 -0
- data/spec/support/v4.2/db/migrate/20190620001234_create_wizards.rb +12 -0
- data/spec/support/v4.2/db/migrate/20190620003037_create_wands.rb +11 -0
- data/spec/support/v4.2/db/migrate/20190620003739_create_spell_books.rb +8 -0
- data/spec/support/v4.2/db/migrate/20190622000000_add_more_column_types_to_wands.rb +10 -0
- data/spec/support/v4.2/db/schema.rb +44 -0
- data/spec/support/v4.2/db/seeds.rb +7 -0
- data/spec/support/{5.1.7/test/fixtures → v4.2/lib/assets}/.keep +0 -0
- data/spec/support/{5.1.7/test/fixtures/files → v4.2/lib/tasks}/.keep +0 -0
- data/spec/support/{5.1.7/test/integration → v4.2/log}/.keep +0 -0
- data/spec/support/v4.2/public/404.html +67 -0
- data/spec/support/v4.2/public/422.html +67 -0
- data/spec/support/v4.2/public/500.html +66 -0
- data/spec/support/{5.1.7/test/mailers/.keep → v4.2/public/favicon.ico} +0 -0
- data/spec/support/v4.2/public/robots.txt +5 -0
- data/spec/support/{5.1.7/test/models → v4.2/test/controllers}/.keep +0 -0
- data/spec/support/{5.1.7/tmp → v4.2/test/fixtures}/.keep +0 -0
- data/spec/support/{5.1.7/vendor → v4.2/test/helpers}/.keep +0 -0
- data/spec/support/{5.2.3/lib/tasks → v4.2/test/integration}/.keep +0 -0
- data/spec/support/{5.2.3/log → v4.2/test/mailers}/.keep +0 -0
- data/spec/support/{5.2.3/storage → v4.2/test/models}/.keep +0 -0
- data/spec/support/{5.1.7 → v4.2}/test/test_helper.rb +0 -0
- data/spec/support/{5.2.3/test/controllers → v4.2/vendor/assets/stylesheets}/.keep +0 -0
- data/spec/support/v5.0/.gitignore +21 -0
- data/spec/support/v5.0/Gemfile +37 -0
- data/spec/support/{5.1.7 → v5.0}/README.md +0 -0
- data/spec/support/{5.1.7 → v5.0}/Rakefile +0 -0
- data/spec/support/{5.1.7 → v5.0}/app/channels/application_cable/channel.rb +0 -0
- data/spec/support/{5.1.7 → v5.0}/app/channels/application_cable/connection.rb +0 -0
- data/spec/support/v5.0/app/controllers +1 -0
- data/spec/support/{5.1.7 → v5.0}/app/jobs/application_job.rb +0 -0
- data/spec/support/{5.1.7 → v5.0}/app/mailers/application_mailer.rb +0 -0
- data/spec/support/v5.0/app/models +1 -0
- data/spec/support/{5.1.7 → v5.0}/app/views/layouts/mailer.html.erb +0 -0
- data/spec/support/{5.1.7 → v5.0}/app/views/layouts/mailer.text.erb +0 -0
- data/spec/support/v5.0/bin/bundle +3 -0
- data/spec/support/v5.0/bin/rails +4 -0
- data/spec/support/v5.0/bin/rake +4 -0
- data/spec/support/v5.0/bin/setup +34 -0
- data/spec/support/{5.1.7 → v5.0}/bin/update +0 -0
- data/spec/support/{5.1.7 → v5.0}/config.ru +0 -0
- data/spec/support/v5.0/config/application.rb +30 -0
- data/spec/support/{5.1.7 → v5.0}/config/boot.rb +0 -0
- data/spec/support/v5.0/config/cable.yml +9 -0
- data/spec/support/v5.0/config/database.yml +25 -0
- data/spec/support/{5.1.7 → v5.0}/config/environment.rb +0 -0
- data/spec/support/v5.0/config/environments/development.rb +47 -0
- data/spec/support/v5.0/config/environments/production.rb +78 -0
- data/spec/support/v5.0/config/environments/test.rb +42 -0
- data/spec/support/{5.1.7 → v5.0}/config/initializers/application_controller_renderer.rb +0 -0
- data/spec/support/{5.2.3 → v5.0}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/support/{5.1.7 → v5.0}/config/initializers/cors.rb +0 -0
- data/spec/support/{5.2.3 → v5.0}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/support/{5.2.3 → v5.0}/config/initializers/inflections.rb +0 -0
- data/spec/support/{5.2.3 → v5.0}/config/initializers/mime_types.rb +0 -0
- data/spec/support/v5.0/config/initializers/new_framework_defaults.rb +18 -0
- data/spec/support/{5.1.7 → v5.0}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/support/v5.0/config/locales/en.yml +23 -0
- data/spec/support/v5.0/config/puma.rb +47 -0
- data/spec/support/v5.0/config/routes.rb +5 -0
- data/spec/support/v5.0/config/secrets.yml +22 -0
- data/spec/support/v5.0/db/migrate +1 -0
- data/spec/support/v5.0/db/schema.rb +45 -0
- data/spec/support/{5.1.7 → v5.0}/db/seeds.rb +0 -0
- data/spec/support/{5.2.3/test/fixtures → v5.0/lib/tasks}/.keep +0 -0
- data/spec/support/{5.2.3/test/fixtures/files → v5.0/log}/.keep +0 -0
- data/spec/support/v5.0/public/robots.txt +5 -0
- data/spec/support/v5.0/rails_symlinks/app/controllers +1 -0
- data/spec/support/v5.0/rails_symlinks/app/models +1 -0
- data/spec/support/v5.0/rails_symlinks/config/routes.rb +5 -0
- data/spec/support/v5.0/rails_symlinks/db/migrate +1 -0
- data/spec/support/{5.2.3/test/integration → v5.0/test/controllers}/.keep +0 -0
- data/spec/support/{5.2.3/test/mailers → v5.0/test/fixtures}/.keep +0 -0
- data/spec/support/{5.2.3/test/models → v5.0/test/fixtures/files}/.keep +0 -0
- data/spec/support/{5.2.3/tmp → v5.0/test/integration}/.keep +0 -0
- data/spec/support/{5.2.3/vendor → v5.0/test/mailers}/.keep +0 -0
- data/spec/support/v5.0/test/models/.keep +0 -0
- data/spec/support/v5.0/test/test_helper.rb +10 -0
- data/spec/support/v5.0/tmp/.keep +0 -0
- data/spec/support/{5.1.7 → v5.1}/Gemfile +6 -6
- data/spec/support/{5.2.3 → v5.1}/README.md +0 -0
- data/spec/support/{5.2.3 → v5.1}/Rakefile +0 -0
- data/spec/support/{5.2.3 → v5.1}/app/channels/application_cable/channel.rb +0 -0
- data/spec/support/{5.2.3 → v5.1}/app/channels/application_cable/connection.rb +0 -0
- data/spec/support/v5.1/app/controllers +1 -0
- data/spec/support/{5.2.3 → v5.1}/app/jobs/application_job.rb +0 -0
- data/spec/support/{5.2.3 → v5.1}/app/mailers/application_mailer.rb +0 -0
- data/spec/support/v5.1/app/models +1 -0
- data/spec/support/{5.2.3 → v5.1}/app/views/layouts/mailer.html.erb +0 -0
- data/spec/support/{5.2.3 → v5.1}/app/views/layouts/mailer.text.erb +0 -0
- data/spec/support/v5.1/bin/bundle +3 -0
- data/spec/support/{5.1.7 → v5.1}/bin/rails +0 -0
- data/spec/support/{5.1.7 → v5.1}/bin/rake +0 -0
- data/spec/support/{5.1.7 → v5.1}/bin/setup +0 -0
- data/spec/support/{5.1.7 → v5.1}/bin/spring +0 -0
- data/spec/support/v5.1/bin/update +29 -0
- data/spec/support/{5.2.3 → v5.1}/config.ru +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/application.rb +0 -0
- data/spec/support/{5.2.3 → v5.1}/config/boot.rb +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/cable.yml +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/database.yml +0 -0
- data/spec/support/{5.2.3 → v5.1}/config/environment.rb +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/environments/development.rb +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/environments/production.rb +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/environments/test.rb +0 -0
- data/spec/support/{5.2.3 → v5.1}/config/initializers/application_controller_renderer.rb +0 -0
- data/spec/support/v5.1/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/support/{5.2.3 → v5.1}/config/initializers/cors.rb +0 -0
- data/spec/support/v5.1/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/support/v5.1/config/initializers/inflections.rb +16 -0
- data/spec/support/v5.1/config/initializers/mime_types.rb +4 -0
- data/spec/support/{5.2.3 → v5.1}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/locales/en.yml +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/puma.rb +0 -0
- data/spec/support/v5.1/config/routes.rb +1 -0
- data/spec/support/{5.1.7 → v5.1}/config/secrets.yml +0 -0
- data/spec/support/{5.1.7 → v5.1}/config/spring.rb +0 -0
- data/spec/support/v5.1/db/migrate +1 -0
- data/spec/support/{5.1.7 → v5.1}/db/schema.rb +0 -0
- data/spec/support/{5.2.3 → v5.1}/db/seeds.rb +0 -0
- data/spec/support/v5.1/lib/tasks/.keep +0 -0
- data/spec/support/v5.1/log/.keep +0 -0
- data/spec/support/{5.1.7 → v5.1}/public/robots.txt +0 -0
- data/spec/support/v5.1/test/controllers/.keep +0 -0
- data/spec/support/v5.1/test/fixtures/.keep +0 -0
- data/spec/support/v5.1/test/fixtures/files/.keep +0 -0
- data/spec/support/v5.1/test/integration/.keep +0 -0
- data/spec/support/v5.1/test/mailers/.keep +0 -0
- data/spec/support/v5.1/test/models/.keep +0 -0
- data/spec/support/v5.1/test/test_helper.rb +10 -0
- data/spec/support/v5.1/tmp/.keep +0 -0
- data/spec/support/v5.1/vendor/.keep +0 -0
- data/spec/support/{5.2.3 → v5.2}/Gemfile +4 -15
- data/spec/support/v5.2/README.md +24 -0
- data/spec/support/v5.2/Rakefile +6 -0
- data/spec/support/v5.2/app/channels/application_cable/channel.rb +4 -0
- data/spec/support/v5.2/app/channels/application_cable/connection.rb +4 -0
- data/spec/support/v5.2/app/controllers +1 -0
- data/spec/support/v5.2/app/jobs/application_job.rb +2 -0
- data/spec/support/v5.2/app/mailers/application_mailer.rb +4 -0
- data/spec/support/v5.2/app/models +1 -0
- data/spec/support/v5.2/app/views/layouts/mailer.html.erb +13 -0
- data/spec/support/v5.2/app/views/layouts/mailer.text.erb +1 -0
- data/spec/support/{5.2.3 → v5.2}/bin/bundle +0 -0
- data/spec/support/{5.2.3 → v5.2}/bin/rails +0 -0
- data/spec/support/{5.2.3 → v5.2}/bin/rake +0 -0
- data/spec/support/{5.2.3 → v5.2}/bin/setup +0 -0
- data/spec/support/{5.2.3 → v5.2}/bin/spring +0 -0
- data/spec/support/{5.2.3 → v5.2}/bin/update +0 -0
- data/spec/support/v5.2/config.ru +5 -0
- data/spec/support/{5.2.3 → v5.2}/config/application.rb +0 -0
- data/spec/support/v5.2/config/boot.rb +3 -0
- data/spec/support/{5.2.3 → v5.2}/config/cable.yml +0 -0
- data/spec/support/{5.2.3 → v5.2}/config/credentials.yml.enc +0 -0
- data/spec/support/{5.2.3 → v5.2}/config/database.yml +0 -0
- data/spec/support/v5.2/config/environment.rb +5 -0
- data/spec/support/{5.2.3 → v5.2}/config/environments/development.rb +1 -1
- data/spec/support/{5.2.3 → v5.2}/config/environments/production.rb +0 -0
- data/spec/support/{5.2.3 → v5.2}/config/environments/test.rb +0 -0
- data/spec/support/v5.2/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/support/v5.2/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/support/v5.2/config/initializers/cors.rb +16 -0
- data/spec/support/v5.2/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/support/v5.2/config/initializers/inflections.rb +16 -0
- data/spec/support/v5.2/config/initializers/mime_types.rb +4 -0
- data/spec/support/v5.2/config/initializers/wrap_parameters.rb +14 -0
- data/spec/support/{5.2.3 → v5.2}/config/locales/en.yml +0 -0
- data/spec/support/{5.2.3 → v5.2}/config/puma.rb +0 -0
- data/spec/support/v5.2/config/routes.rb +1 -0
- data/spec/support/{5.2.3 → v5.2}/config/spring.rb +0 -0
- data/spec/support/{5.2.3 → v5.2}/config/storage.yml +0 -0
- data/spec/support/v5.2/db/migrate +1 -0
- data/spec/support/{5.2.3 → v5.2}/db/schema.rb +4 -4
- data/spec/support/v5.2/db/seeds.rb +7 -0
- data/spec/support/v5.2/lib/tasks/.keep +0 -0
- data/spec/support/v5.2/log/.keep +0 -0
- data/spec/support/{5.2.3 → v5.2}/public/robots.txt +0 -0
- data/spec/support/v5.2/sorbet/.keep +0 -0
- data/spec/support/v5.2/sorbet/config +2 -0
- data/spec/support/v5.2/sorbet/rbi/gems/actioncable.rbi +309 -0
- data/spec/support/v5.2/sorbet/rbi/gems/actionmailer.rbi +439 -0
- data/spec/support/v5.2/sorbet/rbi/gems/actionpack.rbi +3245 -0
- data/spec/support/v5.2/sorbet/rbi/gems/actionview.rbi +1129 -0
- data/spec/support/v5.2/sorbet/rbi/gems/activejob.rbi +281 -0
- data/spec/support/v5.2/sorbet/rbi/gems/activemodel.rbi +740 -0
- data/spec/support/v5.2/sorbet/rbi/gems/activerecord.rbi +3996 -0
- data/spec/support/v5.2/sorbet/rbi/gems/activestorage.rbi +173 -0
- data/spec/support/v5.2/sorbet/rbi/gems/activesupport.rbi +2309 -0
- data/spec/support/v5.2/sorbet/rbi/gems/arel.rbi +1248 -0
- data/spec/support/v5.2/sorbet/rbi/gems/byebug.rbi +1039 -0
- data/spec/support/v5.2/sorbet/rbi/gems/concurrent-ruby.rbi +1583 -0
- data/spec/support/v5.2/sorbet/rbi/gems/crass.rbi +92 -0
- data/spec/support/v5.2/sorbet/rbi/gems/erubi.rbi +26 -0
- data/spec/support/v5.2/sorbet/rbi/gems/globalid.rbi +98 -0
- data/spec/support/v5.2/sorbet/rbi/gems/i18n.rbi +191 -0
- data/spec/support/v5.2/sorbet/rbi/gems/loofah.rbi +129 -0
- data/spec/support/v5.2/sorbet/rbi/gems/mail.rbi +1091 -0
- data/spec/support/v5.2/sorbet/rbi/gems/marcel.rbi +12 -0
- data/spec/support/v5.2/sorbet/rbi/gems/method_source.rbi +63 -0
- data/spec/support/v5.2/sorbet/rbi/gems/mini_mime.rbi +45 -0
- data/spec/support/v5.2/sorbet/rbi/gems/minitest.rbi +276 -0
- data/spec/support/v5.2/sorbet/rbi/gems/nokogiri.rbi +1006 -0
- data/spec/support/v5.2/sorbet/rbi/gems/puma.rbi +570 -0
- data/spec/support/v5.2/sorbet/rbi/gems/rack-test.rbi +161 -0
- data/spec/support/v5.2/sorbet/rbi/gems/rack.rbi +534 -0
- data/spec/support/v5.2/sorbet/rbi/gems/rails-dom-testing.rbi +67 -0
- data/spec/support/v5.2/sorbet/rbi/gems/rails-html-sanitizer.rbi +90 -0
- data/spec/support/v5.2/sorbet/rbi/gems/railties.rbi +722 -0
- data/spec/support/v5.2/sorbet/rbi/gems/rake.rbi +251 -0
- data/spec/support/v5.2/sorbet/rbi/gems/sqlite3.rbi +353 -0
- data/spec/support/v5.2/sorbet/rbi/gems/thor.rbi +449 -0
- data/spec/support/v5.2/sorbet/rbi/gems/thread_safe.rbi +81 -0
- data/spec/support/v5.2/sorbet/rbi/gems/tzinfo.rbi +407 -0
- data/spec/support/v5.2/sorbet/rbi/hidden-definitions/errors.txt +10040 -0
- data/spec/support/v5.2/sorbet/rbi/hidden-definitions/hidden.rbi +24386 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/actionmailer/all/actionmailer.rbi +13 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/actionpack/all/actionpack.rbi +13 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +51 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/activerecord/~>5.2/activerecord.rbi +10 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +107 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +8547 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/railties/all/railties.rbi +22 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +111 -0
- data/spec/support/v5.2/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +543 -0
- data/spec/support/v5.2/sorbet/rbi/todo.rbi +11 -0
- data/spec/support/v5.2/storage/.keep +0 -0
- data/spec/support/v5.2/test/controllers/.keep +0 -0
- data/spec/support/v5.2/test/fixtures/.keep +0 -0
- data/spec/support/v5.2/test/fixtures/files/.keep +0 -0
- data/spec/support/v5.2/test/integration/.keep +0 -0
- data/spec/support/v5.2/test/mailers/.keep +0 -0
- data/spec/support/v5.2/test/models/.keep +0 -0
- data/spec/support/{5.2.3 → v5.2}/test/test_helper.rb +0 -0
- data/spec/support/v5.2/tmp/.keep +0 -0
- data/spec/support/v5.2/vendor/.keep +0 -0
- data/spec/support/v6.0/.gitignore +26 -0
- data/spec/support/v6.0/Gemfile +35 -0
- data/spec/support/v6.0/README.md +24 -0
- data/spec/support/v6.0/Rakefile +6 -0
- data/spec/support/v6.0/app/channels/application_cable/channel.rb +4 -0
- data/spec/support/v6.0/app/channels/application_cable/connection.rb +4 -0
- data/spec/support/v6.0/app/controllers +1 -0
- data/spec/support/v6.0/app/jobs/application_job.rb +7 -0
- data/spec/support/v6.0/app/mailers/application_mailer.rb +4 -0
- data/spec/support/v6.0/app/models +1 -0
- data/spec/support/v6.0/app/views/layouts/mailer.html.erb +13 -0
- data/spec/support/v6.0/app/views/layouts/mailer.text.erb +1 -0
- data/spec/support/v6.0/bin/bundle +105 -0
- data/spec/support/v6.0/bin/rails +4 -0
- data/spec/support/v6.0/bin/rake +4 -0
- data/spec/support/v6.0/bin/setup +33 -0
- data/spec/support/v6.0/config.ru +5 -0
- data/spec/support/v6.0/config/application.rb +37 -0
- data/spec/support/v6.0/config/boot.rb +3 -0
- data/spec/support/v6.0/config/cable.yml +10 -0
- data/spec/support/v6.0/config/credentials.yml.enc +1 -0
- data/spec/support/v6.0/config/database.yml +25 -0
- data/spec/support/v6.0/config/environment.rb +5 -0
- data/spec/support/v6.0/config/environments/development.rb +52 -0
- data/spec/support/v6.0/config/environments/production.rb +105 -0
- data/spec/support/v6.0/config/environments/test.rb +48 -0
- data/spec/support/v6.0/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/support/v6.0/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/support/v6.0/config/initializers/cors.rb +16 -0
- data/spec/support/v6.0/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/support/v6.0/config/initializers/inflections.rb +16 -0
- data/spec/support/v6.0/config/initializers/mime_types.rb +4 -0
- data/spec/support/v6.0/config/initializers/wrap_parameters.rb +14 -0
- data/spec/support/v6.0/config/locales/en.yml +33 -0
- data/spec/support/v6.0/config/puma.rb +35 -0
- data/spec/support/v6.0/config/routes.rb +5 -0
- data/spec/support/v6.0/config/storage.yml +34 -0
- data/spec/support/v6.0/db/migrate +1 -0
- data/spec/support/v6.0/db/schema.rb +47 -0
- data/spec/support/v6.0/db/seeds.rb +7 -0
- data/spec/support/v6.0/lib/tasks/.keep +0 -0
- data/spec/support/v6.0/log/.keep +0 -0
- data/spec/support/v6.0/public/robots.txt +1 -0
- data/spec/support/v6.0/storage/.keep +0 -0
- data/spec/support/v6.0/test/channels/application_cable/connection_test.rb +11 -0
- data/spec/support/v6.0/test/controllers/.keep +0 -0
- data/spec/support/v6.0/test/fixtures/.keep +0 -0
- data/spec/support/v6.0/test/fixtures/files/.keep +0 -0
- data/spec/support/v6.0/test/integration/.keep +0 -0
- data/spec/support/v6.0/test/mailers/.keep +0 -0
- data/spec/support/v6.0/test/models/.keep +0 -0
- data/spec/support/v6.0/test/test_helper.rb +13 -0
- data/spec/support/v6.0/tmp/.keep +0 -0
- data/spec/support/v6.0/vendor/.keep +0 -0
- data/spec/test_data/{5.2.3 → v4.2}/expected_no_routes.rbi +1 -1
- data/spec/test_data/v4.2/expected_potion.rbi +113 -0
- data/spec/test_data/{5.1.7 → v4.2}/expected_routes.rbi +0 -0
- data/spec/test_data/v4.2/expected_spell_book.rbi +146 -0
- data/spec/test_data/v4.2/expected_wand.rbi +278 -0
- data/spec/test_data/v4.2/expected_wizard.rbi +239 -0
- data/spec/test_data/v4.2/expected_wizard_wo_spellbook.rbi +239 -0
- data/spec/test_data/{5.1.7 → v5.0}/expected_no_routes.rbi +1 -1
- data/spec/test_data/{5.2.3 → v5.0}/expected_potion.rbi +58 -62
- data/spec/test_data/v5.0/expected_routes.rbi +13 -0
- data/spec/test_data/v5.0/expected_spell_book.rbi +155 -0
- data/spec/test_data/{5.1.7 → v5.0}/expected_wand.rbi +125 -72
- data/spec/test_data/v5.0/expected_wizard.rbi +248 -0
- data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +248 -0
- data/spec/test_data/v5.1/expected_no_routes.rbi +11 -0
- data/spec/test_data/{5.1.7 → v5.1}/expected_potion.rbi +62 -60
- data/spec/test_data/v5.1/expected_routes.rbi +13 -0
- data/spec/test_data/v5.1/expected_spell_book.rbi +161 -0
- data/spec/test_data/v5.1/expected_wand.rbi +293 -0
- data/spec/test_data/v5.1/expected_wizard.rbi +254 -0
- data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +254 -0
- data/spec/test_data/v5.2/expected_no_routes.rbi +11 -0
- data/spec/test_data/v5.2/expected_potion.rbi +128 -0
- data/spec/test_data/{5.2.3 → v5.2}/expected_routes.rbi +0 -0
- data/spec/test_data/v5.2/expected_spell_book.rbi +161 -0
- data/spec/test_data/{5.2.3 → v5.2}/expected_wand.rbi +135 -70
- data/spec/test_data/v5.2/expected_wizard.rbi +254 -0
- data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +254 -0
- data/spec/test_data/v6.0/expected_no_routes.rbi +11 -0
- data/spec/test_data/v6.0/expected_potion.rbi +140 -0
- data/spec/test_data/v6.0/expected_routes.rbi +91 -0
- data/spec/test_data/v6.0/expected_spell_book.rbi +173 -0
- data/spec/test_data/v6.0/expected_wand.rbi +335 -0
- data/spec/test_data/v6.0/expected_wizard.rbi +278 -0
- data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +278 -0
- metadata +752 -281
- data/spec/support/5.1.7/app/controllers +0 -1
- data/spec/support/5.1.7/app/models +0 -1
- data/spec/support/5.1.7/config/routes.rb +0 -1
- data/spec/support/5.1.7/db/migrate +0 -1
- data/spec/support/5.2.3/app/controllers +0 -1
- data/spec/support/5.2.3/app/models +0 -1
- data/spec/support/5.2.3/config/routes.rb +0 -1
- data/spec/support/5.2.3/db/migrate +0 -1
- data/spec/test_data/5.1.7/expected_wizard.rbi +0 -207
- data/spec/test_data/5.1.7/expected_wizard_wo_spellbook.rbi +0 -207
- data/spec/test_data/5.2.3/expected_wizard.rbi +0 -207
- data/spec/test_data/5.2.3/expected_wizard_wo_spellbook.rbi +0 -207
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a4e4c9b0f6d3cb813771d9673fb2c483507292f
|
|
4
|
+
data.tar.gz: d34bda0c4a4a9269b8bf6a32cd8e7734888613d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a346f014c1761602c445cc5ce1241e9643988433776c7d05f250f0a85d355bf5226a15b160ed1bf843b1d2268069ed736e16687a9a013e0494a3000aae20eb5
|
|
7
|
+
data.tar.gz: 7844cc11287fe4108610435b9b8cba3387d122c0a074b92c89d22ad058ffcbc0c17cca311c9e38c38314ec049c30c25933359183d5b3f7cfbfe7de8a3c5e0f6e
|
data/.codecov.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Report a bug
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Describe the bug:**
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
**Steps to reproduce:**
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
**Expected behavior:**
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
**Versions:**
|
|
17
|
+
<!-- Please include what software versions you are running.
|
|
18
|
+
You can get many of these by running CLI commands, such as:
|
|
19
|
+
$ ruby --version
|
|
20
|
+
$ rails --version
|
|
21
|
+
$ srb --version
|
|
22
|
+
-->
|
|
23
|
+
- Ruby:
|
|
24
|
+
- Rails:
|
|
25
|
+
- Sorbet:
|
|
26
|
+
- Sorbet-Rails:
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
env:
|
|
3
|
-
|
|
4
|
-
-
|
|
3
|
+
matrix:
|
|
4
|
+
- RAILS_VERSION=4.2
|
|
5
|
+
- RAILS_VERSION=5.0
|
|
6
|
+
- RAILS_VERSION=5.1
|
|
7
|
+
- RAILS_VERSION=5.2
|
|
8
|
+
- RAILS_VERSION=6.0
|
|
9
|
+
global:
|
|
10
|
+
secure: S3rpBSDgDQjhA11/80dZ4RUlBP3XLJWOgvcl1eySFdXqHCZGS5p8Fa97yEvZHWiPInUTNhdvyQ5LHlgzu1CCZ9+MOykpEgYo+1yIueriv9Ia5PUNFbwhRp2eBkluSUMPNPOxf15mUlgAGdScnssRL9zftYel29dw4yg+BQnnkLOqpnLO7wHTjouEmp7M8Y/1j0ScIZ0tZL1ovDq70Lst+TJKHm4jdBbwoNmILIwNBgnzZT1LdAuaXVHEmwLvy0GLvClewuSmToJ4jyjuJorCjyMhyoBLrutSuN4KaJcSlP/LVtH4ZCFkFDayDMiVcSyUE3asSnL3yxGL0K99lgwNk4D58WWic7N+0UKnGoiMQOHC9EIsQKaxfXMOpO+Cq5wYhgmFzPGF4iL6ZBNCehcc+ToBojprmJw/0Ev71OS2YGvu5SZpYco5AvJeR73IUA2K0rjUEeY3gXm60aIac09kQuuminN3hUkJ894YoA35B8IEU0uW2uL5n/vX2Y8SD6RV8csbKlhpJmphYYWQQOYjHuFoW4MVnnrFHq6YIUDQpi6/We3I4xH3kvfjIpSemrYOmfF4PPXCarWA7ryI9ytR7BloQ0NQH7hqp1hbKN86LAy8zanW08xNOrxI7VDdbtV1k6mf+wiV1W2Vo54HYEDIw0+jwmW/uKWatTyRo5AUsMc=
|
|
5
11
|
rvm:
|
|
6
|
-
- 2.
|
|
7
|
-
- 2.
|
|
12
|
+
- 2.3
|
|
13
|
+
- 2.4
|
|
14
|
+
- 2.5
|
|
15
|
+
- 2.6
|
|
16
|
+
- ruby-head
|
|
17
|
+
matrix:
|
|
18
|
+
exclude:
|
|
19
|
+
- rvm: 2.3
|
|
20
|
+
env: RAILS_VERSION=6.0
|
|
21
|
+
- rvm: 2.4
|
|
22
|
+
env: RAILS_VERSION=6.0
|
|
23
|
+
allow_failures:
|
|
24
|
+
- rvm: ruby-head
|
|
8
25
|
before_install:
|
|
9
26
|
- gem install bundler -v 2.0.1 --no-doc
|
|
27
|
+
- gem install bundler -v 1.17.3 --no-doc
|
|
28
|
+
install: "./spec/bin/install.sh"
|
|
10
29
|
script:
|
|
11
|
-
-
|
|
30
|
+
- "./spec/bin/run_spec.sh"
|
|
12
31
|
deploy:
|
|
13
32
|
provider: rubygems
|
|
14
33
|
api_key:
|
|
15
|
-
secure:
|
|
34
|
+
secure: AVQi+tC5+HEoGgOKj/+/UeizOkwgVoB8zdPrd48/H9rx1KsAAmQ+2N9srOnrrEkm9I/bvHLOs0JpM96IiXFhztzrDefkaYQc1Zhu3tbWKZf6kuw0gabTMGhx3JsLoQiYRbJYea1qfrL0XlvQTxgkaa4zGJQaIBIZ97X7jlG5lVcys7JGjUFkozGJgS0t2HDffgDPLs3SiWR380Zvo4xcogw9tFHg5MuirZM/bXb9C/WhdDmKV9LbM8bTkJBjkZ0jbzKITtDJWSCXzdjRebLesTVN6F6cNWkwp2TumefgpQId4uGa5iUN8nXriqN890jjeZ3xHDq7xF0dRZgr8TyreocevCtNPCl+12c9ook0+mJn2GFTJL4W9BTuBGkBFekcQZ5MChWywcJ280iuPfX56Ilpt0wkCtWgB0k+k+eGTgEUv0iLykRFytNfiXr1oySG6mzxcUMf90IxfIKMydjFl8ZmAoTmZDfECtk59IW3PRwfHnNiNwmGMIGz9x9geO0wORWWnqdAwvHnQ7wMdScbSZ/VIPvpBdNe3rbhh4xAXXen+t1V0jvAlkBng9GLCwaRWuAsQG3fvRCbjWGxVmCLaQjUqIoJOtNVgeww+s5bXc8eVUtJ2UNRNnlN78lCWrRBhEfgRoyhVzl47vSZjhOE/2JlmQhpot9nwmMOz1h9wk8=
|
|
16
35
|
gem: sorbet-rails
|
|
17
36
|
on:
|
|
18
|
-
tags: true
|
|
19
37
|
repo: chanzuckerberg/sorbet-rails
|
|
38
|
+
branch: setup_travis
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Contributing to Sorbet Rails
|
|
2
|
+
|
|
3
|
+
Thank you for taking the time to contribute to this project!
|
|
4
|
+
|
|
5
|
+
This project adheres to the Contributor Covenant
|
|
6
|
+
[code of conduct](https://github.com/chanzuckerberg/.github/tree/master/CODE_OF_CONDUCT.md).
|
|
7
|
+
By participating, you are expected to uphold this code. Please report unacceptable behavior
|
|
8
|
+
to opensource@chanzuckerberg.com.
|
|
9
|
+
|
|
10
|
+
This project is licensed under the [MIT license](LICENSE.md).
|
|
11
|
+
|
|
12
|
+
## Need Help?
|
|
13
|
+
|
|
14
|
+
If you are trying to integrate Sorbet into your project, consider these venues:
|
|
15
|
+
|
|
16
|
+
* **Stack Overflow**: Try the [sorbet](https://stackoverflow.com/questions/tagged/sorbet)
|
|
17
|
+
and [sorbet + ruby-on-rails](https://stackoverflow.com/questions/tagged/sorbet+ruby-on-rails) tags
|
|
18
|
+
* **Slack**: [the Sorbet community](https://sorbet.org/en/community) includes
|
|
19
|
+
[#discuss](https://sorbet-ruby.slack.com/app_redirect?channel=discuss) and
|
|
20
|
+
[#rails](https://sorbet-ruby.slack.com/app_redirect?channel=rails) channels
|
|
21
|
+
|
|
22
|
+
If you've come here to report an issue, you're in the right place!
|
|
23
|
+
|
|
24
|
+
## Reporting Bugs and Adding Functionality
|
|
25
|
+
|
|
26
|
+
We're excited you'd like to contribute to Sorbet Rails!
|
|
27
|
+
|
|
28
|
+
When reporting a bug, please include:
|
|
29
|
+
* Steps to reproduce
|
|
30
|
+
* The versions of Ruby, Ruby on Rails, Sorbet, and this gem that you are using
|
|
31
|
+
* A test case, if you are able
|
|
32
|
+
|
|
33
|
+
**If you believe you have found a security issue, please contact us at security@chanzuckerberg.com**
|
|
34
|
+
rather than filing an issue here.
|
|
35
|
+
|
|
36
|
+
When proposing new functionality, please include test coverage. We're also available in
|
|
37
|
+
the Sorbet Slack [#rails](https://sorbet-ruby.slack.com/app_redirect?channel=rails) channel
|
|
38
|
+
to discuss your idea before you get started, just to make sure everyone is on the same page.
|
|
39
|
+
|
|
40
|
+
## Local Development
|
|
41
|
+
|
|
42
|
+
1. Clone `sorbet-rails` locally:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
❯ git clone https://github.com/chanzuckerberg/sorbet-rails.git
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. Point your project's Gemfile to your local clone:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
# -- Gemfile --
|
|
52
|
+
|
|
53
|
+
gem 'sorbet-rails', path: "~/sorbet-rails"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The most important files are:
|
|
57
|
+
|
|
58
|
+
* [`rbi/activerecord.rbi`](rbi/activerecord.rbi): The ActiveRecord RBI.
|
|
59
|
+
If you change anything in this file, it will be reflected when you run `srb tc`.
|
|
60
|
+
|
|
61
|
+
* [`lib/sorbet-rails/model_rbi_formatter.rb`](lib/sorbet-rails/model_rbi_formatter.rb):
|
|
62
|
+
Generates RBI files for models. You can regenerate these using `bundle exec rake rails_rbi:models`.
|
|
63
|
+
|
|
64
|
+
* [`lib/sorbet-rails/routes_rbi_formatter.rb`](lib/sorbet-rails/routes_rbi_formatter.rb):
|
|
65
|
+
Generates an RBI files for routes. You can regenerate these using `bundle exec rake rails_rbi:routes`.
|
|
66
|
+
|
|
67
|
+
## Tests
|
|
68
|
+
|
|
69
|
+
Tests are written using [RSpec](https://rspec.info/). Each pull request is run against
|
|
70
|
+
multiple versions of both Ruby and Ruby on Rails. A code coverage report is also generated.
|
|
71
|
+
|
|
72
|
+
### Running Tests
|
|
73
|
+
|
|
74
|
+
You can run tests using `bundle exec rake`.
|
|
75
|
+
|
|
76
|
+
By default, tests will run against a Rails 5.2.x test application.
|
|
77
|
+
|
|
78
|
+
To run the tests against all supported Rails branches, use:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
❯ ./spec/bin/run_all_specs.sh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can also switch to a version of Rails with `RAILS_VERSION`:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
❯ RAILS_VERSION=4.2 ./spec/bin/run_spec.sh
|
|
88
|
+
❯ RAILS_VERSION=5.1 ./spec/bin/run_spec.sh
|
|
89
|
+
❯ RAILS_VERSION=5.2 ./spec/bin/run_spec.sh
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Debugging
|
|
93
|
+
|
|
94
|
+
It is possible to run only one file's tests:
|
|
95
|
+
```sh
|
|
96
|
+
❯ bundle exec rspec spec/model_rbi_formatter_spec.rb
|
|
97
|
+
```
|
|
98
|
+
Or a specific test in a file:
|
|
99
|
+
```sh
|
|
100
|
+
❯ bundle exec rspec spec/model_rbi_formatter_spec.rb:28
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For debugging, you could use [byebug](https://github.com/deivid-rodriguez/byebug), which is
|
|
104
|
+
installed in development mode. If you're not familiar with byebug, add `byebug` where you want
|
|
105
|
+
execution to stop, which will then start a debugger. For more, check out the
|
|
106
|
+
[byebug guide](https://github.com/deivid-rodriguez/byebug/blob/master/GUIDE.md).
|
|
107
|
+
|
|
108
|
+
### Writing Tests
|
|
109
|
+
|
|
110
|
+
Tests are in the `_spec.rb` files in the [`spec/`](spec/) directory.
|
|
111
|
+
|
|
112
|
+
Rails apps are stored in [`spec/support/`](spec/support/). Code shared across Rails versions
|
|
113
|
+
(models, views, controllers) are in [`spec/support/rails_shared/`](spec/support/rails_shared/)
|
|
114
|
+
and symlinked to the individual Rails apps.
|
|
115
|
+
|
|
116
|
+
To update the routes, see
|
|
117
|
+
[`rails_shared/config/routes.rb`](spec/support/rails_shared/config/routes.rb)
|
|
118
|
+
and [`rails_shared/app/controller/`](spec/support/rails_shared/app/controller/).
|
|
119
|
+
|
|
120
|
+
To update the models, see [`rails_shared/app/models/`](spec/support/rails_shared/app/models/).
|
|
121
|
+
Add database migrations to [`rails_shared/db/migrate/`](spec/support/rails_shared/db/migrate/)
|
|
122
|
+
and remember to run `bundle exec rake db:migrate` in each application directory.
|
|
123
|
+
|
|
124
|
+
#### Expected Output
|
|
125
|
+
|
|
126
|
+
If your new tests make changes to the expected output, you can update the expected output
|
|
127
|
+
by running:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
❯ ./spec/bin/update_test_data.sh
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Only do this once you're confident that your code is correct, because it will update
|
|
134
|
+
the expected test data stored in [`spec/test_data/`](spec/test_data/) based on your current
|
|
135
|
+
code, and all tests will then pass.
|
data/Gemfile
CHANGED
|
@@ -9,14 +9,32 @@ end
|
|
|
9
9
|
|
|
10
10
|
rails_version = ENV["RAILS_VERSION"] || "default"
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
gem "
|
|
12
|
+
case rails_version
|
|
13
|
+
when "master"
|
|
14
|
+
gem "rails", {github: "rails/rails"}
|
|
15
|
+
gem "bundler", ">= 1.3.0"
|
|
16
|
+
when "4.2"
|
|
17
|
+
gem "rails", "~> 4.2.11"
|
|
18
|
+
gem "bundler", "~> 1.17.3"
|
|
19
|
+
gem "sqlite3", "~> 1.3.6"
|
|
20
|
+
when "5.0"
|
|
21
|
+
gem "rails", "~> 5.0.7"
|
|
22
|
+
gem "bundler", ">= 2.0"
|
|
23
|
+
gem "sqlite3", "~> 1.3.6"
|
|
24
|
+
when "5.1"
|
|
25
|
+
gem "rails", "~> 5.1.7"
|
|
26
|
+
gem "bundler", ">= 2.0"
|
|
27
|
+
gem "sqlite3", "~> 1.4.1"
|
|
28
|
+
when "5.2"
|
|
29
|
+
gem "rails", "~> 5.2.3"
|
|
30
|
+
gem "bundler", ">= 2.0"
|
|
31
|
+
gem "sqlite3", "~> 1.4.1"
|
|
32
|
+
when "6.0"
|
|
33
|
+
gem "rails", "~> 6.0.0.rc1"
|
|
34
|
+
gem "bundler", ">= 2.0"
|
|
35
|
+
gem "sqlite3", "~> 1.4.1"
|
|
36
|
+
else
|
|
37
|
+
gem "rails", ">= 5.2.3"
|
|
38
|
+
gem "bundler", ">= 2.0"
|
|
39
|
+
gem "sqlite3", "~> 1.4.1"
|
|
40
|
+
end
|
data/README.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# sorbet-rails
|
|
2
2
|
[](https://badge.fury.io/rb/sorbet-rails)
|
|
3
|
-
[](https://travis-ci.com/chanzuckerberg/sorbet-rails)
|
|
4
4
|
[](https://codecov.io/gh/chanzuckerberg/sorbet-rails)
|
|
5
5
|
|
|
6
6
|
A set of tools to make the [Sorbet](https://sorbet.org) typechecker work with Ruby on Rails seamlessly.
|
|
7
7
|
|
|
8
8
|
This gem adds a few Rake tasks to generate Ruby Interface (RBI) files for dynamic methods generated by Rails. It also includes signatures for related Rails classes. The RBI files are added to a `sorbet/rails-rbi/` folder.
|
|
9
9
|
|
|
10
|
+
`sorbet-rails` supports Rails 4.2 or later.
|
|
11
|
+
|
|
10
12
|
## Initial Setup
|
|
11
13
|
|
|
12
14
|
1. Follow the steps [here](https://sorbet.org/docs/adopting) to set up the latest version of Sorbet, up to being able to run `srb tc`.
|
|
13
15
|
|
|
16
|
+
Note: Do not add `sorbet-rails` to your Gemfile until after you've set up Sorbet. `sorbet-rails` adds RBI files that may [break](https://github.com/sorbet/sorbet/issues/1158) `srb init`.
|
|
17
|
+
|
|
14
18
|
2. Add `sorbet-rails` to your Gemfile and install them with Bundler.
|
|
15
19
|
|
|
16
20
|
```
|
|
@@ -29,9 +33,9 @@ gem 'sorbet-rails'
|
|
|
29
33
|
❯ rake rails_rbi:models
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
4.
|
|
36
|
+
4. Automatically upgrade each file's typecheck level:
|
|
33
37
|
```sh
|
|
34
|
-
❯ srb
|
|
38
|
+
❯ srb rbi suggest-typed
|
|
35
39
|
```
|
|
36
40
|
Because we've generated RBI files for routes and models, a lot more files should be typecheckable now.
|
|
37
41
|
|
|
@@ -64,11 +68,27 @@ The generation task currently creates the following signatures:
|
|
|
64
68
|
- Named scopes
|
|
65
69
|
- Model relation class
|
|
66
70
|
|
|
67
|
-
```
|
|
68
|
-
Skip method ... because it is not autogenerated by Rails.
|
|
69
|
-
```
|
|
70
71
|
## Tips & Tricks
|
|
71
72
|
|
|
73
|
+
### Overriding generated signatures
|
|
74
|
+
|
|
75
|
+
`sorbet-rails` relies on Rails reflection to generate signatures. There are features this gem doesn't support yet such as [serialize](https://github.com/chanzuckerberg/sorbet-rails/issues/49) and [attribute custom types](https://github.com/chanzuckerberg/sorbet-rails/issues/16). The gem also doesn't know the signature of any methods you have overridden. However, it is possible to override the signatures that `sorbet-rails` generates.
|
|
76
|
+
|
|
77
|
+
For example, here is how to override the signature for a method in a model:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
# -- app/models/model_name.rbi --
|
|
81
|
+
|
|
82
|
+
# typed: strong
|
|
83
|
+
class ModelName
|
|
84
|
+
sig { returns(T::Hash[...]) }
|
|
85
|
+
def field_name; end
|
|
86
|
+
|
|
87
|
+
sig { params(obj: T::Hash[....]).void }
|
|
88
|
+
def field_name=(obj); end
|
|
89
|
+
end
|
|
90
|
+
```
|
|
91
|
+
|
|
72
92
|
### `find`, `first` and `last`
|
|
73
93
|
|
|
74
94
|
These 3 methods can either return a single nilable record or an array of records. Sorbet does not allow us to define multiple signatures for a function ([except stdlib](https://github.com/chanzuckerberg/sorbet-rails/issues/18)). It doesn't support defining one function signature that has varying returning value depending on the input parameter type. We opt to define the most commonly used signature for these methods, and monkey-patch new functions for the secondary use case.
|
|
@@ -123,9 +143,22 @@ Because Sorbet's initial setup tries to flag files at whichever typecheck level
|
|
|
123
143
|
|
|
124
144
|
It is worth going through the list of files that is ignored and resolve them (and auto upgrade the types of other files; see [initial setup](#initial-setup) above). Usually this will make many more files able to be typechecked.
|
|
125
145
|
|
|
146
|
+
### `unscoped` with a block
|
|
147
|
+
|
|
148
|
+
The [`unscoped` method](https://apidock.com/rails/ActiveRecord/Scoping/Default/ClassMethods/unscoped) returns a `Relation` when no block is provided. When a block is provided, `unscoped` calls the block and returns its result, which could be any type.
|
|
149
|
+
|
|
150
|
+
`sorbet-rails` chooses to define `unscoped` as returning a `Relation` because it's more common and more useful. If you want to use a block, either override the `unscoped` definition, or replace:
|
|
151
|
+
```ruby
|
|
152
|
+
Model.unscoped do … end
|
|
153
|
+
```
|
|
154
|
+
with:
|
|
155
|
+
```ruby
|
|
156
|
+
Model.unscoped.scoping do … end
|
|
157
|
+
```
|
|
158
|
+
|
|
126
159
|
## Contributing
|
|
127
160
|
|
|
128
|
-
Contributions and ideas are welcome! Please don't hesitate to open an issue or send a pull request to improve the functionality of this gem.
|
|
161
|
+
Contributions and ideas are welcome! Please see [our contributing guide](CONTRIBUTING.md) and don't hesitate to open an issue or send a pull request to improve the functionality of this gem.
|
|
129
162
|
|
|
130
163
|
This project adheres to the Contributor Covenant [code of conduct](https://github.com/chanzuckerberg/.github/tree/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to opensource@chanzuckerberg.com.
|
|
131
164
|
|
|
@@ -8,10 +8,12 @@ class ModelRbiFormatter
|
|
|
8
8
|
@model_class = model_class
|
|
9
9
|
@available_classes = available_classes
|
|
10
10
|
@columns_hash = model_class.table_exists? ? model_class.columns_hash : {}
|
|
11
|
-
@
|
|
11
|
+
@generated_instance_module_sigs = ActiveSupport::HashWithIndifferentAccess.new
|
|
12
|
+
@generated_instance_sigs = ActiveSupport::HashWithIndifferentAccess.new
|
|
12
13
|
@generated_class_sigs = ActiveSupport::HashWithIndifferentAccess.new
|
|
13
14
|
@generated_scope_sigs = ActiveSupport::HashWithIndifferentAccess.new
|
|
14
15
|
@generated_querying_sigs = ActiveSupport::HashWithIndifferentAccess.new
|
|
16
|
+
@model_relation_class_name = "#{@model_class.name}::ActiveRecord_Relation"
|
|
15
17
|
begin
|
|
16
18
|
# Load all dynamic instance methods of this model by instantiating a fake model
|
|
17
19
|
@model_class.new unless @model_class.abstract_class?
|
|
@@ -33,19 +35,30 @@ class ModelRbiFormatter
|
|
|
33
35
|
|
|
34
36
|
@buffer << draw_module_header("#{@model_class.name}::#{MODEL_INSTANCE_MODULE_SUFFIX}")
|
|
35
37
|
@model_class.instance_methods.sort.each do |method_name|
|
|
36
|
-
expected_sig = @
|
|
38
|
+
expected_sig = @generated_instance_module_sigs[method_name]
|
|
37
39
|
next unless expected_sig.present?
|
|
38
40
|
method_obj = @model_class.instance_method(method_name)
|
|
39
41
|
draw_method(method_name, method_obj, expected_sig)
|
|
40
42
|
end
|
|
41
43
|
@buffer << draw_module_or_class_footer
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
# TODO Enum methods need to be defined under the class definition because sorbet generates them
|
|
46
|
+
# in the hidden-definition.rbi
|
|
47
|
+
# When this issue is resolved, they might go away by running `srb rbi hidden-definitions`
|
|
48
|
+
# This is a sure way to make it work though.
|
|
49
|
+
# https://github.com/sorbet/sorbet/issues/1161
|
|
50
|
+
@buffer << draw_class_header("#{@model_class.name}") # ::#{MODEL_CLASS_MODULE_SUFFIX}")
|
|
51
|
+
@model_class.instance_methods.sort.each do |method_name|
|
|
52
|
+
expected_sig = @generated_instance_sigs[method_name]
|
|
53
|
+
next unless expected_sig.present?
|
|
54
|
+
method_obj = @model_class.instance_method(method_name)
|
|
55
|
+
draw_method(method_name, method_obj, expected_sig)
|
|
56
|
+
end
|
|
44
57
|
@model_class.methods.sort.each do |method_name|
|
|
45
58
|
expected_sig = @generated_class_sigs[method_name]
|
|
46
59
|
next unless expected_sig.present?
|
|
47
60
|
method_obj = @model_class.method(method_name)
|
|
48
|
-
draw_method(method_name, method_obj, expected_sig)
|
|
61
|
+
draw_method(method_name, method_obj, expected_sig, is_class_method: true)
|
|
49
62
|
end
|
|
50
63
|
@buffer << draw_module_or_class_footer
|
|
51
64
|
|
|
@@ -71,19 +84,25 @@ class ModelRbiFormatter
|
|
|
71
84
|
@buffer.join("\n")
|
|
72
85
|
end
|
|
73
86
|
|
|
74
|
-
def draw_method(method_name, method_obj, expected_sig)
|
|
87
|
+
def draw_method(method_name, method_obj, expected_sig, is_class_method: false)
|
|
75
88
|
if !method_obj.present?
|
|
76
89
|
# not very actionable because this could be a method in a newer version of Rails
|
|
77
90
|
# puts "Skip method '#{method_name}' because there is no matching method object."
|
|
78
91
|
return
|
|
79
92
|
end
|
|
80
|
-
@buffer << generate_method_sig(method_name, expected_sig).indent(2)
|
|
93
|
+
@buffer << generate_method_sig(method_name, expected_sig, is_class_method).indent(2)
|
|
81
94
|
end
|
|
82
95
|
|
|
83
96
|
def populate_activerecord_querying_methods
|
|
84
97
|
# All is a named scope that most method from ActiveRecord::Querying delegate to
|
|
85
98
|
# rails/activerecord/lib/active_record/querying.rb:21
|
|
86
|
-
@generated_scope_sigs["all"] = { ret:
|
|
99
|
+
@generated_scope_sigs["all"] = { ret: @model_relation_class_name }
|
|
100
|
+
@generated_scope_sigs["unscoped"] = {
|
|
101
|
+
ret: @model_relation_class_name,
|
|
102
|
+
args: [
|
|
103
|
+
{ name: :block, arg_type: :block, value_type: 'T.nilable(T.proc.void)' },
|
|
104
|
+
]
|
|
105
|
+
}
|
|
87
106
|
# It's not possible to typedef all methods in ActiveRecord::Querying module to have the
|
|
88
107
|
# matching type. By generating model-specific sig, we can typedef these methods to return
|
|
89
108
|
# <Model>::Relation class.
|
|
@@ -99,7 +118,7 @@ class ModelRbiFormatter
|
|
|
99
118
|
{name: :args, arg_type: :rest, value_type: 'T.untyped'},
|
|
100
119
|
{name: :block, arg_type: :block, value_type: 'T.nilable(T.proc.void)'},
|
|
101
120
|
],
|
|
102
|
-
ret:
|
|
121
|
+
ret: @model_relation_class_name,
|
|
103
122
|
}
|
|
104
123
|
end
|
|
105
124
|
end
|
|
@@ -117,7 +136,7 @@ class ModelRbiFormatter
|
|
|
117
136
|
next unless source_file.include?('lib/active_record/scoping/named.rb')
|
|
118
137
|
@generated_scope_sigs[method_name] = {
|
|
119
138
|
args: [ name: :args, arg_type: :rest, value_type: 'T.untyped' ],
|
|
120
|
-
ret:
|
|
139
|
+
ret: @model_relation_class_name,
|
|
121
140
|
}
|
|
122
141
|
end
|
|
123
142
|
end
|
|
@@ -128,7 +147,7 @@ class ModelRbiFormatter
|
|
|
128
147
|
# enum attribute is treated differently
|
|
129
148
|
assignable_type = "T.any(Integer, String, Symbol)"
|
|
130
149
|
assignable_type = "T.nilable(#{assignable_type})" if column_def.null
|
|
131
|
-
@
|
|
150
|
+
@generated_instance_module_sigs.merge!({
|
|
132
151
|
"#{column_name}" => { ret: "String" },
|
|
133
152
|
"#{column_name}=" => {
|
|
134
153
|
args: [ name: :value, arg_type: :req, value_type: assignable_type],
|
|
@@ -136,7 +155,7 @@ class ModelRbiFormatter
|
|
|
136
155
|
})
|
|
137
156
|
else
|
|
138
157
|
column_type = type_for_column_def(column_def)
|
|
139
|
-
@
|
|
158
|
+
@generated_instance_module_sigs.merge!({
|
|
140
159
|
"#{column_name}" => { ret: column_type },
|
|
141
160
|
"#{column_name}=" => {
|
|
142
161
|
args: [ name: :value, arg_type: :req, value_type: column_type ],
|
|
@@ -144,12 +163,10 @@ class ModelRbiFormatter
|
|
|
144
163
|
})
|
|
145
164
|
end
|
|
146
165
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
end
|
|
166
|
+
@generated_instance_module_sigs["#{column_name}?"] = {
|
|
167
|
+
ret: "T::Boolean",
|
|
168
|
+
args: [ name: :args, arg_type: :rest, value_type: 'T.untyped' ],
|
|
169
|
+
}
|
|
153
170
|
end
|
|
154
171
|
end
|
|
155
172
|
|
|
@@ -163,7 +180,7 @@ class ModelRbiFormatter
|
|
|
163
180
|
|
|
164
181
|
def populate_single_assoc_getter_setter(assoc_name, reflection)
|
|
165
182
|
# TODO allow people to specify the possible values of polymorphic associations
|
|
166
|
-
assoc_class = assoc_should_be_untyped?(reflection) ? "T.untyped" : reflection.
|
|
183
|
+
assoc_class = assoc_should_be_untyped?(reflection) ? "T.untyped" : "::#{reflection.klass.name}"
|
|
167
184
|
assoc_type = "T.nilable(#{assoc_class})"
|
|
168
185
|
if reflection.belongs_to?
|
|
169
186
|
# if this is a belongs_to connection, we may be able to detect whether
|
|
@@ -174,7 +191,7 @@ class ModelRbiFormatter
|
|
|
174
191
|
end
|
|
175
192
|
end
|
|
176
193
|
|
|
177
|
-
@
|
|
194
|
+
@generated_instance_sigs.merge!({
|
|
178
195
|
"#{assoc_name}" => { ret: assoc_type },
|
|
179
196
|
"#{assoc_name}=" => {
|
|
180
197
|
args: [ name: :value, arg_type: :req, value_type: assoc_type ],
|
|
@@ -184,11 +201,11 @@ class ModelRbiFormatter
|
|
|
184
201
|
|
|
185
202
|
def populate_collection_assoc_getter_setter(assoc_name, reflection)
|
|
186
203
|
# TODO allow people to specify the possible values of polymorphic associations
|
|
187
|
-
assoc_class = assoc_should_be_untyped?(reflection) ? "T.untyped" : reflection.
|
|
204
|
+
assoc_class = assoc_should_be_untyped?(reflection) ? "T.untyped" : "::#{reflection.klass.name}"
|
|
188
205
|
relation_class = relation_should_be_untyped?(reflection) ?
|
|
189
|
-
"ActiveRecord::Associations::CollectionProxy
|
|
190
|
-
"#{assoc_class}::
|
|
191
|
-
@
|
|
206
|
+
"ActiveRecord::Associations::CollectionProxy" :
|
|
207
|
+
"#{assoc_class}::ActiveRecord_Associations_CollectionProxy"
|
|
208
|
+
@generated_instance_sigs.merge!({
|
|
192
209
|
"#{assoc_name}" => { ret: relation_class },
|
|
193
210
|
"#{assoc_name}=" => {
|
|
194
211
|
args: [ name: :value, arg_type: :req, value_type: "T.any(T::Array[#{assoc_class}], #{relation_class})" ],
|
|
@@ -200,26 +217,32 @@ class ModelRbiFormatter
|
|
|
200
217
|
@model_class.defined_enums.each do |enum_name, enum_hash|
|
|
201
218
|
@generated_class_sigs["#{enum_name.pluralize}"] = { ret: "T::Hash[T.any(String, Symbol), Integer]"}
|
|
202
219
|
enum_hash.keys.each do |enum_val|
|
|
203
|
-
@
|
|
220
|
+
@generated_instance_module_sigs["#{enum_val}?"] = { ret: "T::Boolean" }
|
|
221
|
+
@generated_instance_module_sigs["#{enum_val}!"] = { ret: nil }
|
|
204
222
|
@generated_scope_sigs["#{enum_val}"] = {
|
|
205
223
|
args: [ name: :args, arg_type: :rest, value_type: 'T.untyped' ],
|
|
206
|
-
ret:
|
|
224
|
+
ret: @model_relation_class_name,
|
|
225
|
+
}
|
|
226
|
+
# force generating these methods because sorbet's hidden-definitions generate & override them
|
|
227
|
+
@generated_class_sigs["#{enum_val}"] = {
|
|
228
|
+
args: [ name: :args, arg_type: :rest, value_type: 'T.untyped' ],
|
|
229
|
+
ret: @model_relation_class_name,
|
|
207
230
|
}
|
|
208
231
|
end
|
|
209
232
|
end
|
|
210
233
|
end
|
|
211
234
|
|
|
212
235
|
def assoc_should_be_untyped?(reflection)
|
|
213
|
-
polymorphic_assoc?(reflection) ||
|
|
236
|
+
polymorphic_assoc?(reflection) || !@available_classes.include?(reflection.klass.name)
|
|
214
237
|
end
|
|
215
238
|
|
|
216
239
|
def relation_should_be_untyped?(reflection)
|
|
217
240
|
# only type the relation we'll generate
|
|
218
|
-
assoc_should_be_untyped?(reflection) || !@available_classes.include?(reflection.
|
|
241
|
+
assoc_should_be_untyped?(reflection) || !@available_classes.include?(reflection.klass.name)
|
|
219
242
|
end
|
|
220
243
|
|
|
221
244
|
def polymorphic_assoc?(reflection)
|
|
222
|
-
reflection.through_reflection
|
|
245
|
+
reflection.through_reflection ?
|
|
223
246
|
polymorphic_assoc?(reflection.source_reflection) :
|
|
224
247
|
reflection.polymorphic?
|
|
225
248
|
end
|
|
@@ -232,13 +255,13 @@ class ModelRbiFormatter
|
|
|
232
255
|
# Please rerun rake rails_rbi:models to regenerate.
|
|
233
256
|
# typed: strong
|
|
234
257
|
|
|
235
|
-
class #{@
|
|
258
|
+
class #{@model_relation_class_name} < ActiveRecord::Relation
|
|
236
259
|
include #{@model_class.name}::#{MODEL_RELATION_SHARED_MODULE_SUFFIX}
|
|
237
260
|
extend T::Generic
|
|
238
261
|
Elem = type_member(fixed: #{@model_class.name})
|
|
239
262
|
end
|
|
240
263
|
|
|
241
|
-
class #{@model_class.name}::
|
|
264
|
+
class #{@model_class.name}::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
|
|
242
265
|
include #{@model_class.name}::#{MODEL_RELATION_SHARED_MODULE_SUFFIX}
|
|
243
266
|
extend T::Generic
|
|
244
267
|
Elem = type_member(fixed: #{@model_class.name})
|
|
@@ -248,8 +271,7 @@ class ModelRbiFormatter
|
|
|
248
271
|
extend T::Sig
|
|
249
272
|
extend T::Generic
|
|
250
273
|
extend #{@model_class.name}::#{MODEL_RELATION_SHARED_MODULE_SUFFIX}
|
|
251
|
-
|
|
252
|
-
include #{@model_class.name}::InstanceMethods
|
|
274
|
+
include #{@model_class.name}::#{MODEL_INSTANCE_MODULE_SUFFIX}
|
|
253
275
|
Elem = type_template(fixed: #{@model_class.name})
|
|
254
276
|
end
|
|
255
277
|
MESSAGE
|
|
@@ -268,14 +290,18 @@ class ModelRbiFormatter
|
|
|
268
290
|
MESSAGE
|
|
269
291
|
end
|
|
270
292
|
|
|
271
|
-
def
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
293
|
+
def draw_class_header(name)
|
|
294
|
+
<<~MESSAGE
|
|
295
|
+
class #{name}
|
|
296
|
+
extend T::Sig
|
|
297
|
+
MESSAGE
|
|
275
298
|
end
|
|
276
299
|
|
|
277
300
|
def type_for_column_def(column_def)
|
|
278
|
-
cast_type = ActiveRecord::Base.connection.lookup_cast_type_from_column
|
|
301
|
+
cast_type = ActiveRecord::Base.connection.respond_to?(:lookup_cast_type_from_column) ?
|
|
302
|
+
ActiveRecord::Base.connection.lookup_cast_type_from_column(column_def) :
|
|
303
|
+
column_def.cast_type
|
|
304
|
+
|
|
279
305
|
strict_type = active_record_type_to_sorbet_type(cast_type)
|
|
280
306
|
|
|
281
307
|
if column_def.respond_to?(:array?) && column_def.array?
|
|
@@ -300,20 +326,22 @@ class ModelRbiFormatter
|
|
|
300
326
|
Time
|
|
301
327
|
when ActiveRecord::Type::BigInteger, ActiveRecord::Type::Integer, ActiveRecord::Type::DecimalWithoutScale, ActiveRecord::Type::UnsignedInteger
|
|
302
328
|
Integer
|
|
303
|
-
when ActiveRecord::
|
|
329
|
+
when ActiveRecord::Type::Binary, ActiveRecord::Type::String, ActiveRecord::Type::Text
|
|
304
330
|
String
|
|
305
331
|
else
|
|
306
|
-
# Json type is only supported in Rails 5.2
|
|
332
|
+
# Json type is only supported in Rails 5.2 and above
|
|
307
333
|
case
|
|
308
334
|
when Object.const_defined?('ActiveRecord::Type::Json') && klass.is_a?(ActiveRecord::Type::Json)
|
|
309
335
|
"T.any(Array, T::Boolean, Float, Hash, Integer, String)"
|
|
336
|
+
when Object.const_defined?('ActiveRecord::Enum::EnumType') && klass.is_a?(ActiveRecord::Enum::EnumType)
|
|
337
|
+
String
|
|
310
338
|
else
|
|
311
339
|
"T.untyped"
|
|
312
340
|
end
|
|
313
341
|
end
|
|
314
342
|
end
|
|
315
343
|
|
|
316
|
-
def generate_method_sig(method_name, generated_method_def)
|
|
344
|
+
def generate_method_sig(method_name, generated_method_def, is_class_method)
|
|
317
345
|
# generated_method_def:
|
|
318
346
|
# {
|
|
319
347
|
# . ret: <return_type>
|
|
@@ -339,18 +367,21 @@ class ModelRbiFormatter
|
|
|
339
367
|
prefix = ""
|
|
340
368
|
prefix = "*" if arg_def[:arg_type] == :rest
|
|
341
369
|
prefix = "**" if arg_def[:arg_type] == :keyrest
|
|
370
|
+
prefix = "&" if arg_def[:arg_type] == :block
|
|
342
371
|
|
|
343
372
|
"#{prefix}#{arg_def[:name]}"
|
|
344
373
|
}.join(", ")
|
|
345
374
|
end
|
|
346
375
|
|
|
376
|
+
method_prefix = is_class_method ? 'self.' : ''
|
|
377
|
+
|
|
347
378
|
return_type = generated_method_def[:ret] ?
|
|
348
379
|
"returns(#{generated_method_def[:ret]})" :
|
|
349
380
|
"void"
|
|
350
381
|
|
|
351
382
|
<<~MESSAGE
|
|
352
383
|
sig { #{param_sig}#{return_type} }
|
|
353
|
-
def #{method_name}(#{param_def}); end
|
|
384
|
+
def #{method_prefix}#{method_name}(#{param_def}); end
|
|
354
385
|
MESSAGE
|
|
355
386
|
end
|
|
356
387
|
end
|