TIL #super_method

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_loca…


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


Print Share Comment Cite Upload Translate Updates
APA

Augusts Bautra | Sciencx (2025-09-08T11:22:51+00:00) TIL #super_method. Retrieved from https://www.scien.cx/2025/09/08/til-super_method/

MLA
" » TIL #super_method." Augusts Bautra | Sciencx - Monday September 8, 2025, https://www.scien.cx/2025/09/08/til-super_method/
HARVARD
Augusts Bautra | Sciencx Monday September 8, 2025 » TIL #super_method., viewed ,<https://www.scien.cx/2025/09/08/til-super_method/>
VANCOUVER
Augusts Bautra | Sciencx - » TIL #super_method. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/08/til-super_method/
CHICAGO
" » TIL #super_method." Augusts Bautra | Sciencx - Accessed . https://www.scien.cx/2025/09/08/til-super_method/
IEEE
" » TIL #super_method." Augusts Bautra | Sciencx [Online]. Available: https://www.scien.cx/2025/09/08/til-super_method/. [Accessed: ]
rf:citation
» TIL #super_method | Augusts Bautra | Sciencx | https://www.scien.cx/2025/09/08/til-super_method/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.