From: Sebastian Hungerecker Date: 2008-07-19T20:01:31+09:00 Subject: Re: Suggestions for a parsing strategy? David Masover wrote: > Why isn't [the return value of scan] an Enumerator in Ruby 1.9? Or 1.8.7 for that matter. Yes, I've been asking myself this very same question since the release of 1.9. > And I suspect that it would most often be useful for things like #map, if > not used in block form outright. Making it an Enumerator would be somewhat > more efficient than building a whole array first -- and more responsive, if > it's a large string. Also it'd allow you to use the matchdata object inside map if you need to. The way it is now you'd have to do: string.enum_for(:scan,/re/).map do md = Regexp.last_match do_something_with md end instead of just string.scan.map do...end -- Jabber: sepp2k@jabber.org ICQ: 205544826