Show full path name of the ruby file when it get loaded

前端 未结 5 586
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 05:04

When reading source code, I always want to know the full path of the file when it is loaded, is there any callback method in ruby to accomplish this, or any other way to do

5条回答
  •  自闭症患者
    2020-12-10 05:29

    Gordon Wilson's answer is great, just wanted to add that you can also see which libraries were loaded (and their complete path!) , by looking at the output of the variable $" (returns an array of absolute file names)

    e.g. the path of the most recently loaded library is at the end of the array

提交回复
热议问题