From: Tom Sawyer Date: 2003-01-14T07:35:45+09:00 Subject: Re: Array_Of(AClass) On Monday 13 January 2003 12:38 am, Gavin Sinclair wrote: > Sorry, I give up. I can't see how to do it elegantly. I guess it's > just a poor fit for Ruby. yes, i have found it tricky too. you made a good start of it though. i'll play with it later and see what i can come up with. > I think the approach of using a singleton class is good, because you > can access the underlying Array method with "super". My first though > was delegation, or even a blank class with just #method_missing. > However, in these cases, the resulting object wouldn't pass the "is_a? > Array" test. > > I want to highlight this: from a singleton class, you can use "super" > like in normal inheritance. Keep this in mind if you are redefining > methods anytime. I find the pattern > > ... > > I just learned that through this exercise, so I'm glad some good came > of it. ah now that is interesting! i'll have to keep this in mind from hence forth. thanks! -- tom sawyer, aka transami transami@transami.net .''. .''. . *''* :_\/_: . :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'. .''.: /\ : ./)\ ':'* /\ * : '..'. -=:o:=- :_\/_:'.:::. | ' *''* * '.\'/.' _\(/_'.':'.' : /\ : ::::: = *_\/_* -= o =- /)\ ' * '..' ':::' === * /\ * .'/.\'. '._____ * | *..* : |. |' .---"| * | _ .--'| || | _| | * | .-'| __ | | | || | .-----. | |' | || | | | | | || | ___' ' /"\ | '-."". '-' '-.' '` |_. ------------------------------------------------------------