From: Love U Ruby Date: 2013-05-21T23:30:28+09:00 Subject: Re: Enum#each issue Hans Mackowiak wrote in post #1109718: > def meth > [1,2,3].each {|e| p yield(e)} > end > > m = to_enum(:meth) > m.next #=> 1 > Great example! but when you do `m.next`, how internally enumerator works? Just need one clarification. As I understand the below: >> [1,2,4].to_enum => # >> a = [1,2,4].to_enum => # >> a.next => 1 But you enumerate the method `meth`, so when you do `m.next` how things worked as output as `1`? need help here. > m.feed "e" > > m.next > #printed: "e" > #return => 2 > > > as you can see, feed affects the result of yield, BUT the enumerator > method need to take care with it -- Posted via http://www.ruby-forum.com/.