The Singleton Pattern in Ruby

preview_player
Показать описание
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.

0:00 - Introduction
1:29 - How does it work
1:49 - A regular object
2:20 - Implementing the pattern using a custom class
3:12 - Ruby's "Singleton" module
4:01 - Similarities with classes
4:25 - Similarities with modules
4:30 - Similarities with constants

If you want to learn more about design patterns, check out these two books.

#webdev #ruby #designpatterns #singletonpattern
Рекомендации по теме
Комментарии
Автор

which vs code theme are you using? It's amazing

harishvedhamani