Quick Access to Ruby Documentation
1 min read

Quick Access to Ruby Documentation


Dev of the Past

  1. Needs to look up something in the Ruby docs (say, the official doc for class Array).
  2. Goes to browser window.
  3. Goes to search engine.
  4. Searches for Ruby Array.
  5. Gets annoying and useless suggestions, such as:
    • Class: Array (Ruby 3.1.0) (Out-of-date; also not Ruby official doc site).
    • Class: Array (Ruby 2.7.2) (Even more out of date; also not official site).
    • Arrays - Ruby for Beginners (Not!).
    • Ruby Array 101: Primary Methods & How To Use Them(Even more Not!)
  6. Gives up.
  7. Navigates to the official site https://docs.ruby-lang.org.
    1. Clicks on a language (English or Japanese).
    2. Clicks master (or whatever release desired).
    3. Clicks Classes.
    4. Scrolls to (or searches for ) Array.
    5. Clicks on it.
    6. Success!

Dev of the Future

(Wisely has gem webri installed.)

  1. Goes to command window:
  2. Types:
$ webri
webri> Array
Found one class/module name starting with 'Array'
  Array (Array.html)
Opening web page https://docs.ruby-lang.org/en/3.4/Array.html.
Enter fullscreen mode

Exit fullscreen mode

  1. Web page magically opens in browser.

More

webri displays documentation for (details at the links):

Check out the README.

To install:

$ gem install webri
Enter fullscreen mode

Exit fullscreen mode

Then invoke with:

$ webri
webri>
Enter fullscreen mode

Exit fullscreen mode

Note: tested on Ubuntu and Windows 11.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *