title: Get class location from class object
body: <p>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.</p>
  
  <p>What I am trying to do is get the location of the file where a loaded class is defined:</p>
  
  <pre><code>Foo::Bar.create(:param) # how can I know file location in runtime?
  </code></pre>
  
  <p>For smaller, better organized, projects, I would just search for <code>class Bar</code> but here that is not possible since there are many classes named <code>Bar</code>, and, to make matters worse, some of them are under the same namespace. I know, it's trouble waiting to happen.</p>
  
  <p>Note: I'm using Ruby 1.8.7.</p>