What is this ?

During the days of Ruby 1.8, the ri command was slow. I mean really slow. Glacially. Starting a web browser and looking up a class or method description on ruby-doc.org often felt faster.

Then Mauricio Fernandez produced fastri and qri that produced results a whole lot faster than the native ri tool. Unfortunately, Mauricio seems to have lost interest and didn’t port fastri to ruby 1.9. There are patches porting fastri to 1.9.1, but they are iffy and don’t work well with 1.9.2 and the new rdoc cache format.

With ruby 1.9 and rdoc 2.x/3.x ri became very responsive. However the output format looks like darkfish without the HTML and uses up a lot of space.

And subjectively, it’s ugly.

This is where bri comes in: it tries to emulate fastri/qris output format and lookup patterns while using the more current rdoc infrastructure.

To compare, do ‘ri Array’ and ‘bri Array’ and see which appeals more to you.

Too… much… text…

Bri is a Beautiful RI formatter.

Usage

bri Array # looks up the class description of Array in the ri documentation.
          # As of 0.4.4 this form will only output core documentation if
          # available, falling back to gem documentation if no core
          # documentation is found. This way you can look at the documentation
          # of core classes that gems love to money patch without having
          # to scroll back through your terminal.
          # If you really want to see everything there is, use --all:
bri --all Array

bri Array.class_method # looks up the class method of the given class

bri Array#instance_method # looks up the instance method of the given class

bri .class_method # looks up the class method in any class

bri #instance_method # looks up the instance method in any class

bri method # looks up an instance method in any class, first looking for
           # an exact match, then methods names where the beginning matches
           # the given search term, and finally looking for the term
           # anywhere in the method name

Note on ri docs generated by rvm

If you’re using ‘rvm docs generate` and can’t see the listing of methods in class documentations, this is due to rvm marking all methods as private during generation. A workaround for now is to generate the ri documentation with ‘rdoc –ri`.

Caveats

I’m reviving this project that has been left rotting for nearly 8 years. Due to bitrot, changes in rdoc internals and trying to understand my code from back then, some unexpected hickups may arise. All bug reports with references to problematic ri class or method docs are welcome.

Requirements

* Ruby 2.6 or later
* rdoc 6.1 or later
* term-ansicolor

The Cheesy Stuff

There are many bries, but there is only one RI bri. (Apologies to Pierre).