RubyTapas Freebie: Streaming

5 comments

  1. Thanks for helping us keep the code clean and nice!

    I discovered the enumerator-returning functionality by accident the other day when I wanted to create an array of multiple instances of a class.

    First attempt of 2.times { Foo.new } didn’t work as it didn’t return an array. However, 2.times.collect { Foo.new } did the work (I find “collect” alias more expressive than “map” in this case). Another moment when I realized just how much I like working with Ruby.

Leave a Reply to Avdi Grimm Cancel reply

Your email address will not be published. Required fields are marked *