From: Robert Klemme Date: 2006-10-31T05:25:12+09:00 Subject: Re: __FILE__ for requiring file Louis J Scoras wrote: > I think this could get there: > > def __REQUIRING_FILE__; caller[1] =~ /([^:]*):/; $1 end > > But probably only if you don't call it within any other methods. I'll > have to play around some more. I played around already :-) def find_dir caller.each do |cl| if %r{^(.*):\d+(?::in )?$} =~ cl f = $1 return File.dirname(f) if f != __FILE__ end end raise "Not found" end Regards robert