From: Florian Gilcher Date: 2009-12-08T09:56:21+09:00 Subject: Re: how to understand Ruby code? (noting various mixins/includes) Is there a tool to assist here? On Dec 7, 2009, at 8:45 PM, Tony Arcieri wrote: > On Mon, Dec 7, 2009 at 4:47 PM, Greg Hauptmann < > greg.hauptmann.ruby@gmail.com> wrote: > >> Just trying to make sense of the final object structure and where >> methods >> resides seems to be a challenge. The latest one I've been looking at >> are things like AuthLogic and Paperclip which are used in the Rails >> world. >> > > I feel your pain, especially with AuthLogic. It's very difficult to > follow > how methods are dispatched among a quagmire of mixins. I found that YARD does a good job at finding static relationships between classes as well as informing you about them. It also provides a tool that draws you a graph out of them (yard-graph). For a sample: http://yardoc.org/docs/datamapper-dm-core/DataMapper/ Model (includes 2 modules, extends another one, is defined in more then one file and defines multiple helper classes and modules under his namespace. It's not 100%, but catches most reasonable cases. For more gathering, there is still Kernel#set_trace_fun. I experimented with a visualization for that for university, but it explodes horribly quick. Regards, Florian Gilcher