From: "Brian Schröder" Date: 2005-07-28T18:22:11+09:00 Subject: Re: Dir.entries returns [] on the second call On 27/07/05, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Dir.entries returns [] on the second call" > on Wed, 27 Jul 2005 07:45:02 +0900, Joel VanderWerf writes: > > |Stefan Lang wrote: > |> Call dir.rewind before dir.entries and it > |> works as expected. > | > |Thanks! I knew there was a reasonable explanation. > > Maybe reasonable. But still not intuitive. > > How about rewinding before "each" method, that make "entries" (and > other iterating methods) require no rewind? > > matz. > > It seems to me that the choice of the method name is the problem here. It maybe would be better if there was a method +fetch_remaining_entries+ or simply +fetch_remaining+ that returned the remaining entries. IMHO the name Dir.entries suggests that it is an accessor of Dir, and does not imply any change to the state of the dir object. best regards, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/