:glob with a block

Ian Macdonald [mailto:ian@caliban.org] said:


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?

Well I’ve never used that form before (nuby here) but thank you for the info
nonetheless.

And I agree w you; otherwise, we should have named it “Dir.glob_false” on
the block form :slight_smile: Bad surprise here…

I would even prefer that the block form be removed. Sorry.

Ian

kind regards -botp