Suppose I wanted to have an object that uses method_missing which was
contained as a private member variable inside a wrapper class. How could
I get calls to the wrapper object to route through to the internal
object’s method_missing, without having to write any code in the wrapper
object? I guess I’m after some way of hooking the owning object’s
Any help appreciated.
On Thu, Oct 20, 2011 at 7:04 PM, James F.
[email protected] wrote:
Posted via http://www.ruby-forum.com/.
Thanks but I wanted to put the code in the wrapped object so it automatically
intercepts method_missing in Wrapper.
This cannot work unless the wrapped knows who is wrapping it. And
normally (i.e. when setting a member of any other object to reference
your object) your object wouldn’t know when it was wrapped.
Also, it’s a questionable design because you introduce a bidirectional
dependency. Also, what do you do in case of multiple wrappers or
What is it that you really want to solve?