On 10/18/05, evronm <evronm / dtcinc.net> wrote:
>
> Does anyone have any other ideas?

An experiment:

class Class
  def inherited(p1)
    @@filenames ||= {}
    @@filenames[p1]=(caller[0]) if caller.size > 0
  end

  def filename
    @@filenames[self]
  end
end

Put this in a file called classfile.rb, and try this:

C:\_Ryan\ruby>ruby -rclassfile -rerb -rostruct -e'p ERB.filename;p
OpenStruct.filename'
"c:/ruby/lib/ruby/1.8/erb.rb:238"
"c:/ruby/lib/ruby/1.8/ostruct.rb:33"

This doesn't work for modules.

Ryan