# Statically generated call graph

**URL:** <https://www.ruby-forum.com/t/statically-generated-call-graph/122938>\
**Category:** Ruby\
**Created:** [December 12, 2007, 10:10pm UTC](https://www.ruby-forum.com/t/statically-generated-call-graph/122938 "2007-12-12T22:10:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [December 12, 2007, 10:10pm UTC](https://www.ruby-forum.com/t/statically-generated-call-graph/122938/1 "2007-12-12T22:10:22Z")

</div>

Is there anything out there that will statically analyse a ruby  
project and spit out a call graph? It needn’t be 100% complete or  
accurate, just static (all I could find from google was profilers that  
spat out call graphs in passing)

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [December 12, 2007, 11:25pm UTC](https://www.ruby-forum.com/t/statically-generated-call-graph/122938/2 "2007-12-12T23:25:05Z")

</div>

On 12.12.2007 08:35, Martin DeMello wrote:

> Is there anything out there that will statically analyse a ruby  
> project and spit out a call graph? It needn’t be 100% complete or  
> accurate, just static (all I could find from google was profilers that  
> spat out call graphs in passing)

I don’t think there are any. The issue is, how do you want to do that?  
Since you have no type information you cannot generate this graph - or  
the graph will be so large that most branches are never traversed. For  
example, what do you expect such a tool to output for this:

def f(x) x.to\_s end

Basically, since you do not know what x will be you have to put in all  
classes #to\_s method etc. Am I missing something?

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [December 13, 2007, 1:03am UTC](https://www.ruby-forum.com/t/statically-generated-call-graph/122938/3 "2007-12-13T01:03:04Z")

</div>

On Dec 12, 2007 1:29 PM, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> example, what do you expect such a tool to output for this:
> 
> def f(x) x.to\_s end
> 
> Basically, since you do not know what x will be you have to put in all  
> classes #to\_s method etc. Am I missing something?

Oh - good point 🙂 Didn’t think it through enough - I was thinking  
more along the lines of determining which methods within a class did  
and didn’t depend on other methods from that class.

martin
