TIL #super_method



This content originally appeared on DEV Community and was authored by Augusts Bautra

Consider this:

def name
  binding.pry

  "#{super} #{last_name}"
end

You pry into a method and want to find out the source/location of other called methods. Usually this is easy, just method(:last_name).source or method(:last_name).source_location and voila. But what if the method calls super? 🤔

Not to worry, #super_method to the rescue:

> method(__method__).super_method.source
> method(__method__).super_method.source_location


This content originally appeared on DEV Community and was authored by Augusts Bautra