Monday, June 11, 2007

unroller




Neat, a unroller for Ruby. You put this into your code and it outputs all the functions that get run, and all the functions that these functions call. It's kind of like a debugger if you were to follow the execution to the bottom of each call, stepping through each function, but just dumps it all to stdout. It's also kind of like a profiler, in that it goes into each function that gets called, it just doesn't time these functions.

Really useful for debugging your Rails applications, you can just put:


around_filter do |controller, action|
Unroller::trace do
action.call
end
end


In your controller, replacing "controller" and "action" with the controller and action you want to unroll, and watch the output either in Webrick, or in your Mongrel logfile.

Really neat.