Ruby definitely stores such information at runtime, as it is printed in stack traces – but there doesn’t seem to be any obvious way of accessing it. Is there a solution? (other than grepping the sources, or passing nonsense arguments to method in hope of getting the stack trace)
Ruby definitely stores such information at runtime, as it is printed in stack traces
Share
In Ruby 1.9, you have Method#source_location:
It appears there’s a request to backport source_location to 1.8 (http://redmine.ruby-lang.org/issues/show/2180), but I’m not sure if/when that will happen.