e.feed obj â nil
Instance Public methods
Sets the value to be returned by the next yield inside e
.
If the value is not set, the yield returns nil.
This value is cleared after being yielded.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | o = Object . new def o. each x = yield # (2) blocks p x # (5) => "foo" x = yield # (6) blocks p x # (8) => nil x = yield # (9) blocks p x # not reached w/o another e.next end e = o.to_enum e. next # (1) e.feed "foo" # (3) e. next # (4) e. next # (7) # (10) |
Please login to continue.