-
Notifications
You must be signed in to change notification settings - Fork 217
Release Note 3.1
Some of the highlights in RBS 3.1 are:
You can install it with $ gem install rbs
or using Bundler.
gem 'rbs', '~> 3.1.0'
Read the CHANGELOG for the details.
There are no (intended) breaking changes in RBS 3.1. You can upgrade safely from 3.0 to 3.1.
rbs subtract
deletes the duplicated definitions from RBS files. That helps working with both auto-generated signatures and manually-changed signatures. You will generate an RBS file with generators, like rbs prototype
or rbs_rails
, and will modify some of the declarations manually for precise type checking. Then you can use the rbs subtract
to avoid re-generated definition breaks everything.
# Generate RBSs for Active Record models under sig/rbs_rails directory
$ bin/rake rbs_rails:all
# Generate RBSs for all Ruby code under sig/prototype directory
$ rbs prototype rb --out-dir=sig/prototype --base-dir=. app lib
# Remove methods generated by RBS Rails from sig/prototype
$ rbs subtract --write sig/prototype sig/rbs_rails
# Remove hand-written methods from generated RBSs
$ rbs subtract --write sig/prototype sig/rbs_rails sig/hand-written
See the spec for more detailed explanations.
You can test if a string is a correct RBS syntax with rbs parse
with -e
option without writing it to a file.
$ rbs parse -e 'class Foo end'
$ rbs parse --type -e 'Array[Integer]'
$ rbs parse --method-type -e '() { () [self: self] } -> void'