Enumerable - Why I Fell in Love with Ruby
Using Ruby's Enumerable module and Enumerator class
I recently gave a talk at both NYC.rb and DCRUG about some great features of Enumerable
that deserve more attention. I touch on interesting use cases for using Enumerable
and Enumerator
including API client libraries, streaming HTTP, web crawlers, CSV parsing, and infinite sequences.
I put together a bunch of code samples for the talk and assembled them in a repository on GitHub:
https://github.com/rossta/loves-enumerable
To run a sample, clone the repo and install the gems:
$ git clone https://github.com/rossta/loves-enumerable.git
$ cd loves-enumerable
$ bundle install
Then simply run the code with the ruby executable.
$ ruby code/pascals_triangle.rb
You'll get the most out of this repo by inspecting the source along with following the presentation.