Sunday, August 29, 2010

The Ruby Metaprogramming Spell Book

Here are all the spells from Metaprogramming Ruby, as link-friendly Gists.

March 2014 update: I updated this list to match the second edition of the book. I added three spells that are new to Ruby 2.x: Refinement, Refinement Wrapper and Prepended Wrapper. I also dropped a few spells that don't seem to be as relevant today as they used to be, at least in the context of this book: Argument Array, Named Arguments, Pattern Dispatch and Class Extension Mixin.


  1. Would be great if this could be turned into a single cheatsheet. Awesome memory refresher, thanks!

  2. Thanks, Andy! You can download the PDF appendix listing all the spells from the book's page ( Not really a cheat sheet, but it should do.