Hi --

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.


David

-- 
                   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