-
Notifications
You must be signed in to change notification settings - Fork 229
Release Note 2.7
RBS 2.7.0.pre.1 is the latest version of RBS 2.7.
Some of the highlights in RBS 2.7 are:
You can install it with $ gem install --pre rbs or using bundler.
gem 'rbs', '~> 2.7.0.pre.1'
See the CHANGELOG for the details.
You can upgrade RBS 2.6 in Ruby programs safely without any modification, if you don't use the self type binding.
See #1077 for the detail.
Some Ruby methods like #instance_eval evaluates the block with self other than outside of the block.
123.instance_eval do
# self is `123`, not the toplevel object
endThe feature is frequently used in DSL definitions, or .scope method in ActiveRecord::Base is one of the most frequently seen examples of the feature.
RBS 2.7 introduces a new syntax to declare a block is evaluated under different self:
class Foo
def foo: () { () [self: String] -> void } -> void
endThe [self: String] is the self type binding of a block of method #foo. The implementation would look like the following:
class Foo
# foo receives a block, and it evaluate with self that is a String
def foo(&block) = "hello".instance_eval(&block)
endRBS 2.7 provides a RDoc plugin that reads RBS files and generates RDoc.
$ bundle exec rdoc sig
This is preliminary implementation of the RDoc support. It lacks many important features -- supporting generic classes, generating interface & type alias docs, ...
Acknowledgement: This work is supported by Google Summer of Code 2022.