From: Robert Klemme Date: 2008-01-23T22:08:14+09:00 Subject: Re: Determine where a method is being called from? 2008/1/23, Paolo Nusco Perrotta : > On Jan 22, 2008 4:47 PM, Ben Johnson wrote: > > Is it possible to determine if a public instance method is being called > > from an object or within the class? > > If I understood correctly, you want to look into the call stack. If > so, you must resort to an hack. I do not see how using #caller is a hack. I was under the impression that Ben rather wanted a static analysis, i.e. determine code coverage. This is next to impossible with a dynamic language such as Ruby. A simple approach would be to grep all involved source files and look for the method's name. But if that is a common name or overloaded a lot you're out of luck. Kind regards robert -- use.inject do |as, often| as.you_can - without end