Dir::glob with a block

Ara.T.Howard [mailto:ahoward@fattire.ngdc.noaa.gov] replied:


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…

but what is Dir#each ?

-a

kind regards -botp