Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (16 sloc) 277 Bytes
module Subject
def initialize
@observers = []
end
def add_observer(observer)
@observers << observer
end
def remove_observer(observer)
@observers.delete(observer)
end
def notify_observers
@observers.each do |observer|
observer.update(self)
end
end
end