Creating Ruby enumerators on the fly
When you treat your collections as enumerators, you get to use all your favorite functions like #map and #reduce without having to write any extra code. In this post I show you how easy it is to create enumerators on the fly, without defining extra classes or messing around with the Enumerable module. http://blog.honeybadger.io/creating-ruby-enumerators-on-the-fly/
Comments
Lovely, tiny example. You might also enjoy reading: http://blog.arkency.com/2014/01/ruby-to-enum-for-enumerator/ :)
Post a comment