lib/enumerator.fy in fancy-0.4.0 vs lib/enumerator.fy in fancy-0.5.0
- old
+ new
@@ -29,16 +29,16 @@
Returns the next element in the collection this enumerator is attached to.
It will move the internal position forward (compared to e.g. #peek, which doesn't).
Example:
- a = [1,2,3]
- e = a to_enum
- e next # => 1
- e next # => 2
- e next # => 3
- e next # => raises Fancy StopIteration
+ a = [1,2,3]
+ e = a to_enum
+ e next # => 1
+ e next # => 2
+ e next # => 3
+ e next # => raises Fancy StopIteration
"""
if: @peeked then: {
@peeked = false
@peek
@@ -68,18 +68,18 @@
internal position forward.
When the position reaches the end, a Fancy StopIteration exception is
raised.
Example:
- a = [1,2,3]
- e = a to_enum
- e next p #=> 1
- e peek p #=> 2
- e peek p #=> 2
- e peek p #=> 2
- e next p #=> 2
- e next p #=> 3
- e next p #=> raises Fancy StopIteration
+ a = [1,2,3]
+ e = a to_enum
+ e next p #=> 1
+ e peek p #=> 2
+ e peek p #=> 2
+ e peek p #=> 2
+ e next p #=> 2
+ e next p #=> 3
+ e next p #=> raises Fancy StopIteration
"""
unless: @peeked do: {
@peeked = true
@peek = @fiber resume