From: Adam Van Den Hoven Date: 2005-09-28T05:32:24+09:00 Subject: Re: Class and Iterator Design Question Let me suggest yet another possibility, borrowing from Hash: obj.each { | element, container | ... } You could even combine that with 1? I like Mine and #1 . On 27-Sep-05, at 12:24 PM, Jim Freeze wrote: > On 9/27/05, Jim Freeze wrote: > > Concerning multiple containers for an object: > >> Here are four methods that I can see as potential solutions: >> >> 1. obj.each(:container) { |element| ... } >> 2. obj.each_container { |element| ... } >> 3. obj.container.each { |element| ... } >> 4. obj.container; obj.each { |element| ... } >> >> No. (4) simply sets an internal state variable to indicate which >> container >> #each uses. Not pretty, and not thread safe, but permits >> Enumerable to >> be used. >> > > I am curious what people think about these methods. > To all you pattern experts, is there a pattern for this > situation? > > -- > Jim Freeze > >