LXR style cross references Ruby code

While trying to navigate a large, unfamiliar application, I find a
cross referenced browser invaluable.

For statically typed languages, there exist a whole bunch: LXR, the
browser part of MSVC IDE, etc.

For Ruby, are there any?

I realize that it won’t be perfect, as you can’t always know excatly
where the method is defined. But a simple algorithm which would
certainly be at least 80/20 would be:

  1. If it is proceeded by a dot, it is a method name
  2. To guess the class of any object: If you see: variable_name =
    CapitalLetter.something, you can guess that variable_name is an
    instance of CapitalLetter
  3. To find a method definition, first look through the methods defined
    for that class (RDoc is already able to parse them), then look through
    the current file, then, through all the files required in. Failing
    that, link to a simple search page, listing all of the places where it
    is defined.

For me, a simple browser like this makes all the difference navigating
unfamiliar code.

I have no experience with CTags - maybe it could be used to do
something like this?


PS For a radically different approach, how 'bout using Ruby to load the
app in a sandbox, and reflect across the entire ObjectSpace to figure
everything out? Could this be done? I know it’s a lot of work -
beyond the scope of my initial request - but, if it could, it could add
code completion and refactoring to dynamic lang IDE’s, something which
many developers truely miss.

Huh?!

I thought everyone would jump at this.

Am I the only one who finds these type of cross references TREMENDOUSLY
USEFUL?

[email protected] wrote:

Huh?!

I thought everyone would jump at this.

Am I the only one who finds these type of cross references
TREMENDOUSLY USEFUL?
Maybe because RDoc does most of the cross-references you want, if only
you follow the rules and you can read the code.
So you can use your normal browser :slight_smile:
Cheers,
V.-

http://www.braveworld.net/riva

[email protected] writes:

Huh?!

I thought everyone would jump at this.

Am I the only one who finds these type of cross references TREMENDOUSLY
USEFUL?

Where are the millions of lines of Ruby they would be needed for? :slight_smile: