From: Ashley Moran Date: 2006-07-26T19:31:55+09:00 Subject: Re: get caller of method Thanks for the replies people On Wednesday 26 July 2006 10:44, Pit Capitain wrote: > Ashley, in addition to Sean's answer, remember that the methods you > define at the toplevel, outside of any class, aren't singleton methods > of the "main" object. Instead, they are private methods of class Object. > Since every class is a subclass of Object, they inherit these "toplevel" > methods. In your method Foo#test, you're actually calling > > � �self.global_test > > so you're not calling a method of a different object. The following is > based on your code above: I think I get it now. I assumed that top-level methods were singleton methods. I'll have to watch this - I've been busy writing DSLs lately so my code is apparently littered with methods added to Object, I didn't realise they could be called anywhere. Ashley -- "If you do it the stupid way, you will have to do it again" - Gregory Chudnovsky