Find Out Where A Method Is Defined In Ruby

Posted By Weston Ganger

Sometimes you may have an error in a method somewhere and you want to find out where it is defined. Here are two extremely helpful methods for finding out this information. Note these methods require Ruby 1.9+

"55".method(:to_i).source_location
"55".method(:to_i).owner

Related External Links:

Article Topic:Software Development - Ruby / Rails

Date:June 09, 2016