# LXR style cross references Ruby code

**URL:** <https://www.ruby-forum.com/t/lxr-style-cross-references-ruby-code/99404>\
**Category:** Ruby\
**Created:** [December 12, 2005, 10:55pm UTC](https://www.ruby-forum.com/t/lxr-style-cross-references-ruby-code/99404 "2005-12-12T22:55:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [December 12, 2005, 10:55pm UTC](https://www.ruby-forum.com/t/lxr-style-cross-references-ruby-code/99404/1 "2005-12-12T22:55:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [December 13, 2005, 4:38am UTC](https://www.ruby-forum.com/t/lxr-style-cross-references-ruby-code/99404/2 "2005-12-13T04:38:59Z")

</div>

Huh?!

I thought everyone would jump at this.

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

---

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [December 14, 2005, 10:47am UTC](https://www.ruby-forum.com/t/lxr-style-cross-references-ruby-code/99404/3 "2005-12-14T10:47:10Z")

</div>

removed\_email\_address@domain.invalid 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 🙂  
> Cheers,  
> V.-  
> –  
> [http://www.braveworld.net/riva](http://www.braveworld.net/riva)

---

<div class="post-metadata">

**Author:** ![lstrecv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e68b1a/32.png) [@lstrecv](https://www.ruby-forum.com/u/lstrecv)\
**Post date:** [December 14, 2005, 6:21pm UTC](https://www.ruby-forum.com/t/lxr-style-cross-references-ruby-code/99404/4 "2005-12-14T18:21:53Z")

</div>

removed\_email\_address@domain.invalid 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? 🙂
