From: Ilias Lazaridis Date: 2011-05-30T16:55:27+09:00 Subject: Re: CORE - Object Instantiation and Location On 27 Μάϊος, 07:51, Ilias Lazaridis wrote: > On 26 Μάϊος, 13:31, Roger Braun wrote: > > > 2011/5/26 Ilias Lazaridis : > > > > What I'm looking for: > > > > how can I detect WHERE the object was instantiated? > > > This seems to do what you need. > > >http://snippets.dzone.com/posts/show/2787 > > > See also here: > > >http://www.ruby-doc.org/core/classes/Kernel.html#M001397 > > This one could lead to a solution, at least a temporal one. > > I can retrieve from the Kernel.caller the call stack, and from there > the information
. > > How can I user the string "
" or "" to retrieve > the actual object of main or MyClass? for "class:MyClass' obj = Kernel.const_get("MyClass") #=> returns object which represents MyClass for "main"? How can I retrieve the "main" object? . -- http://lazaridis.com