Module: Saucy::Notifications

Defined in:
lib/saucy/notifications.rb

Constant Summary collapse

@@observers =
[]

Class Method Summary collapse

Class Method Details

.clear_observersObject



7
8
9
# File 'lib/saucy/notifications.rb', line 7

def self.clear_observers
  @@observers = []
end

.notify_observers(event, data) ⇒ Object



15
16
17
18
19
# File 'lib/saucy/notifications.rb', line 15

def self.notify_observers(event, data)
  @@observers.each do |observer|
    observer.send(event, data) if observer.respond_to?(event)
  end
end

.register_observer(observer) ⇒ Object



11
12
13
# File 'lib/saucy/notifications.rb', line 11

def self.register_observer(observer)
  @@observers << observer
end