On Thu 11 Mar 2004 at 01:34:38 +0900, Ara.T.Howard wrote:

> On Wed, 10 Mar 2004, Ian Macdonald wrote:
> 
> > According to ri, Dir.glob returns false when invoked with a block:
> > 
> > -------------------------------------------------------------- Dir::glob
> >      Dir.glob( string, [flags] ) => array
> >      Dir.glob( string, [flags] ) {| filename | block }  => false
> > ------------------------------------------------------------------------
> > 
> > My observation is that it would be much more useful if the block form
> > also returned an array, consisting of each filename modified by the
> > block. I ran into this today and found I had to use the non-block form
> > with Array#collect.
> > 
> > Is there a good reason for this method being the way it is?
> 
> running on a directory with 100,000 files - which we do alot.  the
> construction of array would balloon your process size...

Good point. It seems, then, that this behaviour should be selectable.
Perhaps there should be a Dir.glob_to_a method, but then again, maybe
that's overkill, as it's so easy to chain the non-block version into
Array#collect.

Ian
-- 
Ian Macdonald               | Weekends were made for programming. - Karl 
System Administrator        | Lehenbauer 
ian / caliban.org             | 
http://www.caliban.org      | 
                            |