A walkthrough of a refactor in Ruby illustrating how to apply the Module Builder pattern. Also introduces some basic metaprogramming techniques that are more widely-applicable.
Much appreciation to Chris Salzberg who coined the pattern and discusses it in-depth here: http://dejimata.com/2017/5/20/the-ruby-module-builder-pattern