Is there a way to loop back an enumerator in Ruby? Given this piece of code:
a=[1,2,3]
a.to_enum
a.next => 1
a.next => 2
a.next => 3
a.next => 1
How can I make the next method go back to the first element when the enumerator reached the last element?