Find the source of a method
Here is a super simple way to find the source code location of any Ruby method. This comes incredibly handy when debugging third party code.
Taking an example class:
class MyClass def hello_world "HelloWorld!" end end
From an instance of that class, you can find the method in question and call
source_location on it to reveal the file path and line number of the code.
MyClass.new.method(:hello_world).source_location # => ["/Users/paul/my_class.rb", 3]