Get class location from class object

后端 未结 7 2072
北恋
北恋 2020-12-13 23:29

I have a bunch of code to look at, and now it is debugging time. Since I have never been a fan of Ruby\'s debugger I am looking for a way of going through code and reading i

7条回答
  •  囚心锁ツ
    2020-12-14 00:27

    Klass.method(Klass.methods.first).source_location
    

    Using source_location for a method, I can search for first method defined in a class. I imagine this is not foolproof due to meta-programming and other hacks.

提交回复
热议问题