Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Observable#notify_observers
notify_observers(*arg)
lib/observer.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/observer.rb, line 218
def notify_observers(*arg)
if defined? @observer_state and @observer_state
if defined? @observer_peers
@observer_peers.each do |k, v|
k.__send__(v, *arg)
end
end
@observer_state = false
end
end
Notify observers of a change in state if this object’s changed state is true.
This will invoke the method named in add_observer, passing *arg. The changed state is then set to false.
*arg-
Any arguments to pass to the observers.