From: Trans Date: 2005-09-27T06:21:43+09:00 Subject: Re: How each class splats Devin Mullins wrote: > Well, you could do this: > > class B < Array > def initialize(i,v) > self[0] = @i = i > self[1] = @v = v > end > end > > But I think your best bet is define your own Collection object with its > own #each. Nah, that ruins the whole point. In my case I'm tryinig to create a general pupose "association" class. So I can do: a >> b Same as Assoc.new(a,b) Please ignore that I'm overridding '>>' ;) So then I do: [ a0 >> b0, a1 >> b1, a2 >> b2 ] And have an object much like an ordered hash. But I also can create a mixed collection if I so need: [ a0 >> b0, c0, a1 >> b1, c1, a2 >> b2, c2 ] But I'm more interested in the ordered-hashish at this point. I want to use it as one normally would use a hash, but alas I don't see any way to do that expect to overide certain methods in Array, especailly #each. So I started thinking how a class might have some generalizing methods to allow this to work. T.