rbs is an actively used header files created in 2020. We defined a new language called RBS for type signatures for Ruby 3. The signatures are written in .rbs files which is different from Ruby code. You can consider the .rbs files are similar to .d.ts files in TypeScript or .h files in C/C++/ObjC. The benefit of having different files is it doesn't require changing Ruby code to start type checking. You can opt-in type checking safely without changing any part of your workflow.

0Years Old ?Users ?Jobs
  • rbs first appeared in 2020
  • file extensions for rbs include rbs
  • See also: ruby
  • Have a question about rbs not answered here? Email me and let me know how I can help.

Example code from the web:

# sig/merchant.rbs

class Merchant
  attr_reader token: String
  attr_reader name: String
  attr_reader employees: Array[Employee]

  def initialize(token: String, name: String) -> void

  def each_employee: () { (Employee) -> void } -> void
                   | () -> Enumerator[Employee, void]
end

Last updated August 9th, 2020

Edit rbs on GitHub