Introspection, in Ruby

I was curious about what an object chart, or dependency graph, looks like in a running application. One of my favorite features about ruby is its ability to introspect; to have awareness of its own state at runtime.

Using the following snippet in your development Rails 4.x application, results in a verbose log file and a tremendously slow page-load time, but provides insightful information about the lifecycle of a request in Rails.

class Application < Rails::Application set_trace_func proc { |event, file, line, id, binding, classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname } end


Comments

A figment of

Afomi is the digital sandbox of Ryan Wold. This site, like myself, is a work in progress. I am always evolving it to better share my inspirations and aspirations.

About

Ryan is a systems-thinking Product Developer and Designer who practices agile, test-driven, and lean software delivery, while solving problems with people.