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 it.
What I am trying to do is get the location of the file where a loaded class is defined:
Foo::Bar.create(:param) # how can I know file location in runtime?
For smaller, better organized, projects, I would just search for class Bar
but here that is not possible since there are many classes named Bar
, and, to make matters worse, some of them are under the same namespace. I know, it's trouble waiting to happen.
Note: I'm using Ruby 1.8.7.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…