On Thu, Oct 03, 2002 at 07:50:02AM +0900, Matt Gushee wrote:
> On Thu, Oct 03, 2002 at 07:44:12AM +0900, William Djaja Tjokroaminata wrote:
> > 
> > If you ever used C++, then you would have known the issue of deleting an
> > element while you are traversing the container using an iterator.
> 
> And for those who haven't used C++ ... what is the issue? And does it
> explain why the simpler method I was planning to suggest doesn't work
> either?
> 
> My suggestion was going to be:
> 
>   fileNames = mp3Dir.entries.collect {|f| f =~ /.*mp3$/}
> 
> or something much like it. But no go.

Oops! Never mind. 'collect' was the wrong method. This works:

   fileNames = mp3Dir.entries.find_all {|f| f =~ /.*mp3$/}

-- 
Matt Gushee
Englewood, Colorado, USA
mgushee / havenrock.com
http://www.havenrock.com/