From: Ilias Lazaridis Date: 2011-05-30T05:10:44+09:00 Subject: Re: CORE - Object Instantiation and Location On 27 Μάϊος, 17:54, Christopher Dicely wrote: > On Fri, May 27, 2011 at 7:46 AM, Christopher Dicely [...] > > And, really, a frequently requested feature by Ruby users (which I > > think was implemented in at least one Gem for pre-1.9 ruby, don't know > > if there is anything that provides it for 1.9) has been something to > > the effect of Binding.of_caller that would return the binding of the > > point from which the current method was called; if such a method > > existed, Ilias request would seem to just be solved by: > > > Binding.of_caller.eval { self } > > Or, more likely: > >  Binding.of_caller.eval "self" http://extensions.rubyforge.org/rdoc/classes/Binding.html http://extensions.rubyforge.org/rdoc/ Yes, this should work, but it seems to have some problems, too: http://www.ruby-forum.com/topic/175402 - There is another solution, which I like more: https://github.com/Asher-/sender found within the answer to this question: http://stackoverflow.com/questions/2016696/getting-module-of-caller-in-ruby - But I try to achieve it without C-level extensions, only with the build in (1.9) object-model / reflection / *documented* call-stack tracing etc. The question is: How to achieve this in a "clean" way, without going to C-level? . -- http://lazaridis.com