Ruby source_location

I was having a very hard time finding how/where a specific legacy method was defined in our Ruby codebase. Every conventional method failed to find it, including searching the entire project for the method name.

To my rescue came an in-built method of locating the source definition on a method in run-time:


Available in Ruby 1.9+.

(Indeed, the method name is dynamically defined by a grep on /in_cents/ columns using dark Ruby such as ​class_eval. Whodathunk.​)