RBS Rails 适用于 Ruby on Rails 的 RBS 文件生成器。 安装 将以下一行添加到应用程序的 Gemfile 中: ruby gem 'rbsrails', require: fa…
RBS Rails 适用于 Ruby on Rails 的 RBS 文件生成器。 安装 将以下一行添加到应用程序的 Gemfile 中: ruby gem 'rbsrails', require: fa…
RBS files generator for Ruby on Rails.
Add this line to your application's Gemfile:
gem 'rbs_rails', require: falseAnd then execute:
$ bundle installOr install it yourself as:
$ gem install rbs_railsRun the following command. It generates lib/tasks/rbs.rake.
$ bin/rails g rbs_rails:installThen, the following three tasks are available.
rbs_rails:generate_rbs_for_models: Generate RBS files for Active Record modelsrbs_rails:generate_rbs_for_path_helpers: Generate RBS files for path helpersrbs_rails:all: Execute all tasks of RBS RailsYou can also run rbs_rails from command line:
# Generate all RBS files
$ bundle exec rbs_rails all
# Generate RBS files for models
$ bundle exec rbs_rails models
# Generate RBS files for path helpers
$ bundle exec rbs_rails path_helpersrails gemYou need to install rails gem's RBS files. I highly recommend using rbs collection.
gem 'rails' to your Gemfile.$ bundle install
$ bundle exec rbs collection init
$ bundle exec rbs collection installYou can customize the behavior of rbs_rails via configuration file. Place one of the following files in your project:
.rbs_rails.rb (in the project root)config/rbs_rails.rb…Put the following code as Steepfile.
target :app do
signature 'sig'
check 'app'
endThat's all! Now you can check your Rails app statically with steep check command.
After checking out the repo, run bin/setup to install dependencies.
You can also run bin/console for an interactive prompt that will allow you to experiment.
This gem uses RBS::Inline to generate RBS files. Please mark up your code with RBS comments.
And then, run bundle exec rake rbs_update to reflect the type definitions to the RBS files.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and push it to the GitHub (via Pull Request). Then, GitHub Actions will automatically create a release tag and publish the gem to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/rbs_rails.
暂无开放 Issues,或尚未同步最近议题。