The Singleton Pattern in Ruby (video)
The Singleton Pattern helps with restricting the number of instances a class can create to just one and gives you a global way of accessing the instance.
This can be useful when you need to manage access to some resource, like a configuration object, or a logger.
Youtube link: https://youtu.be/IP3I_t2rR6A
Post a comment