rbs
rbs copied to clipboard
Type Signature for Ruby
In this example, the binding / evaluation context of the block is said to be `self` https://github.com/ruby/rbs/blob/287808c00f7809e0c1261074c6eb90990d8d1d21/core/basic_object.rbs#L172-L185 ```rbs # Executes the given block within the context of the receiver (*obj*)....
**Summary:** When including two interfaces with a method of the same name in each, an error is thrown; when including an interface that includes them both, the last definition included...
Consider this contrived example: ```ruby class Initializer def self.create(klass) klass.new end end ``` How can this class be annotated in rbs such that the return value is known to be...
This change allows a block to accept another block. An (artificial) example is `def foo: { { -> Integer } -> String } -> Float`, which corresponds to the following...
Hello, I find a bug that the `rbs prototype runtime Object` command fails on **Ruby 3.0** (it succeeds on Ruby 2.7). Please see the reproduction below for details. ## Reproduction...
I arrived at this repository via the [Ruby 3.0.0 Preview 1 Released](https://www.ruby-lang.org/en/news/2020/09/25/ruby-3-0-0-preview1-released/) blog post. The README didn't immediately make it clear to me how this might be integrated into a...
It seems that currently the grammar only supports type constraints in the case of [module declarations](https://github.com/ruby/rbs/blob/deeb903bc6d294860aee1dca50557b25650fc3dc/docs/syntax.md#module-declaration). It would be very useful to be able to constrain type variables, e.g. to...
It would be useful to be able to apply `singleton` to type variables as well as concrete types. As a motivating example consider this simple event bus: ```rb interface _Subscriber[E]...
I was looking at https://github.com/ruby/rbs/blob/c64d1f5ba5a4fbc95ffb1d72d783ee39b17d60fe/stdlib/builtin/builtin.rbs, where a lot of common knownn interfaces are stored. I was wondering whether there should be one for "callable" objects, that is: implements `#call`. Objects...
This is my first time writing RBS so I am not sure it is right, especially the tests. I am not sure how to fully describe `rand` because it can...