Editing Topic: RCR197 Project: RCR | RCRchive home

RCR 197: ri should be accesible thru irb

submitted by gga on Mon Jan 19 2004 03:22:19 AM -0800

Status: pending


Abstract

Add a help() function to irb that would invoke ri on any module.

Problem

Using irb, it is common for newbies to need help checking syntax or verifying methods of classes. Even for those experienced in the language, it is sometimes necessary to consult docs of a module you are unfamiliar with. Python's interactive console allows accessing its docs for any built-in class using help(class). In python, it is even possible to load a module and then do help(module) to obtain information about it. It is also possible to use: help() and enter help mode in the python console. This allows you to basically find help about python's built in commands, list all modules available in all paths of $: and a list of topics about the language.

Proposal

I propose a similar method is used in irb to access ri docs as a start. As a second step, this should be complemented to provide full online help of all ruby commands.

Analysis

Ideally, this should be possible to do even on modules that have NOT had ri run on them.

Implementation

In irb, add a Kernel::help() function that would invoke ri on the given string (assuming a module/class or class#method). If module is found in $: but rdoc has not been run on it to get ri, it should perhaps run rdoc on it automatically?


Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog