I'm puzzled by the behavior of take_while and drop_while when called without
a block. They return enumerators -- that part I understand -- but I'm not
understanding how those enumerators behave.
Here's what I mean:
>> enum = [1,2,3,4,5].take_while
=> #<Enumerator: [1, 2, 3, 4, 5]:take_while>
StopIteration: iteration reached an end
from (irb):3:in `next'
from /Users/dblack/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'
drop_while does the same thing. This behavior doesn't seem particularly useful.
Any ideas on why it is this way (up to and including that it's a bug)?