|
|
|
|
|
by indspenceable
4012 days ago
|
|
Re: Generators - I don't know why it's so hidden, but the Enumerator class allows you to make generators ``` enum = Enumerator.new{|y| a = 0; loop{y << a; a += 1}} enum.next => 0 enum.next => 1 etc ``` I believe this has existed since 1.8x |
|