# Is there a tool to document method invocations?

**URL:** <https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569>\
**Category:** Ruby\
**Created:** [March 29, 2007, 11:22pm UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569 "2007-03-29T23:22:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 29, 2007, 11:22pm UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/1 "2007-03-29T23:22:44Z")

</div>

I’m looking for something that will create a cross-reference document  
showing where all my methods are being used. An ideal world would  
include forward and reverse links within an editor. Are there any  
editors, environments or tools that provide this functionality for Ruby?

Thanks,  
Larry F.

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 29, 2007, 11:35pm UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/2 "2007-03-29T23:35:11Z")

</div>

Larry F. wrote:

> I’m looking for something that will create a cross-reference document  
> showing where all my methods are being used. An ideal world would  
> include forward and reverse links within an editor. Are there any  
> editors, environments or tools that provide this functionality for Ruby?
> 
> Thanks,  
> Larry F.

You can use the excellent ruby-prof in this way.

gem install ruby-prof

If you request the HTML output, you get a page with links from each  
method to callers and callees, plus timing information.

It’s a really nice tool.

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 29, 2007, 11:51pm UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/3 "2007-03-29T23:51:53Z")

</div>

Joel VanderWerf wrote:

> gem install ruby-prof  
> It’s a really nice tool.

OK, but doesn’t it just produce runtime reports? I’m looking for a  
static report on WHERE in my code various objects and methods are used.  
Is this capability buried in ruby-prof somewhere? The docs just talk  
about runtime.

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 30, 2007, 12:38am UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/4 "2007-03-30T00:38:25Z")

</div>

On Mar 29, 2007, at 5:51 PM, Larry F. wrote:

> Joel VanderWerf wrote:
> 
> > gem install ruby-prof  
> > It’s a really nice tool.
> 
> OK, but doesn’t it just produce runtime reports? I’m looking for a  
> static report on WHERE in my code various objects and methods are  
> used.  
> Is this capability buried in ruby-prof somewhere? The docs just talk  
> about runtime.

I’d be surprised if it were even possible to generate a call graph  
based on the static text. Ruby is simply too dynamic of a language.

The main problem is that it is really difficult (impossible?) to  
intuit the class of the object returned by a method call by simply  
looking at the text. Add in the possibility that methods are  
created at run time and it becomes a really _hard_ problem.

Gary W.

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 30, 2007, 12:42am UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/5 "2007-03-30T00:42:58Z")

</div>

Gary W. wrote:

> The main problem is that it is really difficult (impossible?) to  
> intuit the class of the object returned by a method call by simply  
> looking at the text. Add in the possibility that methods are  
> created at run time and it becomes a really _hard_ problem.

… so hard that nobody has even bothered to produce the basics? Don’t  
other development languages have this? How do you live without it?

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 30, 2007, 1:06am UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/6 "2007-03-30T01:06:26Z")

</div>

Perhaps, rcov: [eigenclass.org](http://eigenclass.org/hiki.rb?rcov)  
Though, you’ll need really good test suite to see info for usage of  
_all_ methods 🙂

2007/3/30, Larry F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 30, 2007, 1:55am UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/7 "2007-03-30T01:55:58Z")

</div>

Gary W. wrote:

> grep  
> Gary W.

Yep. That’s what I’m doin’ 'til I build up enough test cases to exercise  
most of my code. rcov sounds like an important piece of this puzzle.

---

<div class="post-metadata">

**Author:** ![lfast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/ee59a6/32.png) [@lfast](https://www.ruby-forum.com/u/lfast)\
**Post date:** [March 30, 2007, 1:13am UTC](https://www.ruby-forum.com/t/is-there-a-tool-to-document-method-invocations/90569/8 "2007-03-30T01:13:28Z")

</div>

On Mar 29, 2007, at 6:42 PM, Larry F. wrote:

> Gary W. wrote:
> 
> > The main problem is that it is really difficult (impossible?) to  
> > intuit the class of the object returned by a method call by simply  
> > looking at the text. Add in the possibility that methods are  
> > created at run time and it becomes a really _hard_ problem.
> 
> … so hard that nobody has even bothered to produce the basics?  
> Don’t  
> other development languages have this? How do you live without it?

grep

But I have looked at call graphs generated when I run my test suites.  
You might find the rcov tool useful for this.

[http://eigenclass.org/hiki.rb?rcov](http://eigenclass.org/hiki.rb?rcov)

Gary W.
