https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-08-23T21:44:41ZRuby Issue Tracking SystemRuby master - Bug #8815: Enumerable.drop_while returns an Enumerator. Calling next twice on the Enumerator raises StopIteration even if there are still items available https://bugs.ruby-lang.org/issues/8815?journal_id=413322013-08-23T21:44:41Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>Not a bug.</p>
<p>Enumerable#drop_while stops if the block returns false (or nil).<br>
You have to feed true value to the enumerator by Enumerator#feed.</p>
<p>enumerator.next # => 1<br>
enumerator.feed(true)<br>
enumerator.next # => 2</p> Ruby master - Bug #8815: Enumerable.drop_while returns an Enumerator. Calling next twice on the Enumerator raises StopIteration even if there are still items available https://bugs.ruby-lang.org/issues/8815?journal_id=413772013-08-28T01:11:00ZJEG2 (James Gray)jeg2@ruby-lang.org
<ul></ul><p>Isn't that backwards?</p>
<pre><code>>> [1, 2, 3].drop_while { nil }
=> [1, 2, 3]
>> [1, 2, 3].drop_while { false }
=> [1, 2, 3]
>> [1, 2, 3].drop_while { true }
=> []
</code></pre>