Method: Observable#notify_observers

Defined in:
lib/fable/observer.rb

#notify_observers(*arg) ⇒ Object

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.



194
195
196
197
198
199
200
201
202
203
# File 'lib/fable/observer.rb', line 194

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