There's a class called Enumerator::Generator in Ruby 1.9.2, and it seems
to have only one method "#each" of its own.
However the ruby-doc page of Enumerator::Generator is empty, I didn't
google out the useage of it.
So, can you give me an example how to use this class?
There's a class called Enumerator::Generator in Ruby 1.9.2, and it seems
to have only one method "#each" of its own.
However the ruby-doc page of Enumerator::Generator is empty, I didn't
google out the useage of it.
So, can you give me an example how to use this class?
p e #=> #<Enumerator: #<Enumerator::Generator:0x1345b00>:each>
well, it seems that e is an Enumerator, but has an Enumerator::Generator
in it. I am confused what on earth Enumerator::Generator is. Can I get
an object that can return "Enumerator::Generator" if I type "obj.class"?
Yes, but please note that #cycle was not used in the example posted by
me which I was referring to. Any simple example can usually be solved
with another approach than Enumerator so I guess most examples which
are good for conveying functionality of Enumerator.new will suffer
from that very same issue.