From: "trans. (T. Onoma)" Date: 2004-11-21T08:01:25+09:00 Subject: Re: Inner Class Relationship On Saturday 20 November 2004 05:31 pm, James Edward Gray II wrote: | I have an inner class that needs to send it's parent object (outer | class) a message when a certain event occurs. | | I would rather not create a method in the outer class for this as it is | a messy implementation detail that should be hidden away under lock and | key. | | Any suggestions for a clean way to implement this? It's a blind spot | for me. | | Thanks. | | James Edward Gray II If I understand correctly, try passing self of parent to the the inner object when it's created. class Inner def initialize( parent ) @parent = parent end end class Outer def initialize Inner.new(self) end end With any luck, in the future we will have a "caller" method that can refer to the parent object from Inner#initialize, i.e. without having to specifically pass self. (Personally I've always thought #object_parent should be built-in anyway.) T.