The Singleton Module and Its Pattern In Ruby

The Singleton Module and Its Pattern In Ruby

The singleton design pattern allows for the creation of an object that is restricted to one single instance. No matter how big or complex your application is, there will only ever be one. This has caused some controversy about the quality and maintainability of code that leverages it. Yet, Ruby’s standard library contains a module that implements this pattern. Let’s take a closer look at this module and the “controversy” around its implemented pattern. Let’s also consider singletons in Ruby and the purpose they serve for the language in general.

Fbc4aecf546e2c379dbb6277956ecec5?s=128

Mike Calhoun

November 19, 2019
Tweet