Trans wrote:
> My immediate thought was then, what about Dir, does it support #glob?
> That was immediately followed by, "hey, I never ever use Dir.new".
> That was key. I looked it up:
> 
> Instance Methods:
>    close, each, path, pos, pos=, read, rewind, seek, tell
> 
> That's it. I don't even fully understand what all those do. It's
> treating a Dir as an IO object?

This is wrapping the diropen function from C.  Calling opendir returns a 
DIR* (which is similar to a FILE*).  Individual directory entities can 
be read one at a time with readdir and the rest just modify the position 
indicator.

Reading them all with glob may not always be appropriate.  On very large 
directories (thousands of files), that would be pretty slow and use a 
good chunk of RAM.

> And there's the problem, what we need are "lazy" File and Dir classes
> that delegate to the IO ones, that allow us to do everything we need,
> rather than fussing with all these others.
> 
> I think I'll throw this together. Anyone else interested?
> 
> T.

Can you give a mockup of what you're talking about?

-- 
Michael Morin
Guide to Ruby
http://ruby.about.com/
Become an About.com Guide:  beaguide.about.com
About.com is part of the New York Times Company