Hi -- On Thu, 19 Oct 2006, Eric Hodel wrote: > On Oct 18, 2006, at 4:18 AM, dblack / wobblini.net wrote: >> On Wed, 18 Oct 2006, James Edward Gray II wrote: >>> On Oct 17, 2006, at 7:29 PM, dblack / wobblini.net wrote: >>>> What's the best way to get an array of lines or bytes from a string in >>>> 1.9? (I think this might help me get more of a grasp of the cases >>>> where an Enumerator is returned.) >>> >>> Well, using the Enumerators both of the following would work: >>> >>> str.lines.to_a >>> >>> str.each_line.to_a >> >> lines sounds like it should already be an array to me (like >> readlines), and each_line doesn't sound like something that should be >> called without a block. In general I guess I'm not understanding the >> whole concept of the non-iterator calls to methods like each*. I >> mean, I understand what's happening, but I'm not sure that the >> traditional iterator method names make sense if there's no block. > > Creating a new Array for enumerating the lines of a 50M String is not going > to be fun (or fast). I'm talking about the method names, though. David > -- > Eric Hodel - drbrain / segment7.net - http://blog.segment7.net > This implementation is HODEL-HASH-9600 compliant > > http://trackmap.robotcoop.com > > -- David A. Black | dblack / wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org