Is there a tool to document method invocations?

L

Larry Fast

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 Fast
 
J

Joel VanderWerf

Larry said:
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 Fast

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.
 
L

Larry Fast

Joel said:
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.
 
G

Gary Wright

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 Wright
 
L

Larry Fast

Gary said:
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?
 
L

Larry Fast

Gary said:
grep
Gary Wright

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top