Skip to content
Type Signature for Ruby
Ruby Yacc
Branch: master
Clone or download

Latest commit

Latest commit 49b8958 Jun 1, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Build in CI May 19, 2020
bin Remove unnecessary `require 'pathname'` May 30, 2020
docs [DOC] Update how to execute all stdlib tests May 30, 2020
exe Rename to RBS May 4, 2020
lib Version 0.3.1 May 22, 2020
stdlib Merge pull request #292 from pocke/Fiber Jun 1, 2020
test Merge pull request #292 from pocke/Fiber Jun 1, 2020
.gitignore Rename to RBS May 4, 2020
.rubocop.yml Update rubocop TargetRubyVersion 2.6 -> 2.7 Jan 10, 2020
BSDL Add BDSL file Jan 18, 2020
CHANGELOG.md Version 0.3.1 May 22, 2020
COPYING Add COPYING Jan 2, 2020
Gemfile Add Vendorer class Jan 3, 2020
README.md small fix for README May 30, 2020
Rakefile Merge pull request #268 from mtsmfm/generator May 16, 2020
rbs.gemspec Add CHANGELOG May 19, 2020

README.md

RBS

RBS provides syntax and semantics definition for the Ruby Signature language, .rbs files. It consists of a parser, the syntax, and class definition interpreter, the semantics.

Build

We haven't published a gem yet. You need to install the dependencies, and build its parser with bin/setup.

$ bin/setup
$ bundle exec exe/rbs

Usage

$ rbs list
$ rbs ancestors ::Object
$ rbs methods ::Object
$ rbs method ::Object tap

rbs list [--class|--module|--interface]

$ rbs list

This command lists all of the classes/modules/interfaces defined in .rbs files.

rbs ancestors [--singleton|--instance] CLASS

$ rbs ancestors Array                    # ([].class.ancestors)
$ rbs ancestors --singleton Array        # (Array.class.ancestors)

This command prints the ancestors of the class. The name of the command is borrowed from Class#ancestors, but the semantics is a bit different. The ancestors command is more precise (I believe).

rbs methods [--singleton|--instance] CLASS

$ rbs methods ::Integer                  # 1.methods
$ rbs methods --singleton ::Object       # Object.methods

This command prints all methods provided for the class.

rbs method [--singleton|--instance] CLASS METHOD

$ rbs method ::Integer '+'               # 1+2
$ rbs method --singleton ::Object tap    # Object.tap { ... }

This command prints type and properties of the method.

Options

It accepts two global options, -r and -I.

-r is for libraries. You can specify the names of libraries.

$ rbs -r set list

-I is for application signatures. You can specify the name of directory.

$ rbs -I sig list

Guides

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

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 then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/ruby-signature.

You can’t perform that action at this time.