On Tue, 20 Feb 2001, Bryan Zarnett wrote: > I agree, having the calling class as part of caller > would be great. Having the line number their is an > excellent bonus!!! > BTW, here's my solution. Difference to Daves solution is that it doesn't require any change to the caller. But it might not work if you've got other trace functions installed and its uglier. Anyway: def calling_object(&b) set_trace_func proc{ |event, file, line, id, binding, classname| case event when "return" if !(id == :calling_object or classname == self.type) b.call(id, classname, file, line) set_trace_func(nil) # Restore old trace_func?! end end } end class Callee def m1 calling_object { |method, klass, file, line| puts "Callee#m1 called from #{klass}##{method} on line #{line} in file #{file}" } end end class Caller def m Callee.new.m1 end end Caller.new.m and here's the output: $ ruby -v calling_object.rb ruby 1.7.0 (2001-01-23) [i686-cygwin] Callee#m1 called from Caller#m on line 23 in file calling_object.rb Regards, Robert