I like to say I started programming by accident. While facilitating a Lego robotics club during my teaching years, I was surprised to realize how much I enjoyed coding. Later, when I first learned Ruby as a full-time developer, I rediscovered that joy.

A big reason for my love of Ruby is the Enumerable module because of its simple, functional style and ability to be combined and chained to form useful constructs - a lot like Legos.

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:


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.

Discuss it on Twitter · Part of the Enumerable series. Published on Nov 17, 2015

Need help with Webpack on Rails?

My name is Ross Kaffenberger.

Webpacker now ships by default in Rails 6 but there's no need to stress. I'm putting together a course to help you master Webpack on Rails.

I teach full stack web developers about frontend tools and performance, especially at the intersection of JavaScript and Ruby on Rails.

Subscribe to stay in the loop.

    More posts