Sha256: c87878acac306ecae23495b1b5b3ef09c3397646a1126d356d5ff8fd85e62368
Contents?: true
Size: 469 Bytes
Versions: 4
Compression:
Stored size: 469 Bytes
Contents
# encoding=utf-8 module OPQ class Observer def initialize(observers) @observers = observers end def add_observer(observer) @observers << observer end def remove_observer(observer) @observers.delete(observer) end def notify_observers(data) @observers.each { |observer| observer.on_data_received(data) } end def on_message_received(msg) notify_observers(msg) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opqr-0.1.5 | lib/opqr/observer.rb |
opqr-0.1.4 | lib/opqr/observer.rb |
opqr-0.1.3 | lib/opqr/observer.rb |
opqr-0.1.2 | lib/opqr/observer.rb |