The Observer pattern (also known as publish/subscribe) provides a simple mechanism for one object to inform a set of interested third-party objects when its state changes.

Source: Module: Observable (Ruby 3.1.2)

I always forget that Ruby has a built-in Oberserver implementation.