The Ruby Module Builder Pattern
Did you know that Ruby has configurable modules? One of the most interesting features of Ruby, the Module Builder Pattern is also probably its least well-known. Simply subclass the
Module class, dynamically define some methods in an initializer, and boom, you can create named, customizable modules to include in other classes. In this talk, I'll explain how I've leveraged this unique feature of Ruby to build a translation gem called Mobility that can handle a wide range of different storage strategies through a single, uniform interface.