I recently open sourced a project called MethodTrails and gave a quick demo at the DC Ruby Users Group. MethodTrails visualizes the method call graph of Ruby source code. It generates a dot file that can be viewed with Graphviz. It requires Ruby 1.9, which gives you a great excuse to download the latest Ruby and see what it is all about.
MethodTrails uses Ruby 1.9’s Ripper to parse any Ruby file into an s-expression. Then it explores the s-expression to find the information it needs to build up the dot file. It does so by using a rule engine, so very little in MethodTrails is hard coded. Tweak it and play around if you want to extract different information.
Below are two sample outputs generated from running MethodTrails on the Net::HTTP library in Ruby 1.8.


One Trackback/Pingback
[...] It felt good to work on something a little different. I gave a quick demo of the project (called Method Trails) to the DC Ruby Users Group. Now I’m refreshed and back and ready to get cranking [...]
Post a Comment