This is the first time I see this way of using the enumerators. The documentation mentions that with no block, an enumerator is returned, but there is not a single example of how to use those enumerators.
Thank you very much!
So, to activate the task of “filter”, “find”, “map”, or whatever method was used to create the enumerator, we have to use each with block. Is that the only interface? I suppose we could use each_with_index, or with_object (which is a reduce). What happens with reduce then?
Thanks to @pcl I understand the difference between enumerators returned by different Enumerable methods.
But now, I’m wondering how this style is used in real life.
Anybody knows in what situations those enumerators extracted from the Enumerable methods called without block are used, or does anybody uses in it’s code?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.