Under ruby 1.8.6, running
[1, 2, 3].collect
results in an array of [1, 2, 3]. In 1.9, however, running
[1, 2, 3].collect
results in an Enumerator, which I then have to call .to_a on.
Alternately, I can supply a block
[1, 2, 3].collect {|x| x }
and end up with an array. So I guess that means that the default block
of {|x| x} was removed from the function. I was just wondering if
anyone had any insight into why that change was made, because it feels
very counter intuitive to me. I really liked the elegance of opening
up a file and just calling collect to turn it into an array.
--
Posted via http://www.ruby-forum.com/.