Sometimes one instance is all you need.


[boilerplate bypath=”rubytapas-sample”]

Published by Avdi Grimm


  1. Why not just use the Singleton Module in stdlib to build your Singletons? This would obviate the need for such strange construction syntax and further clarify (and provide a route to documentation) your intent.

    • The Singleton module is about finding a way to force a class to only permit a single instance. The whole point of this episode is to say, why start with a class and then try to lock it down to once instance? Why not just start with an instance?

      The Singleton Pattern (and Ruby library) is kind of orthogonal, I talk about it more in another episode.


Leave a Reply

Your email address will not be published. Required fields are marked *