From: Ryan Leavengood Date: 2005-10-19T01:51:26+09:00 Subject: Re: Class/Method Filename On 10/18/05, evronm 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