Implementing the factory pattern in Ruby so you don't have to.