stdlib/observer.rb
#
# Add +observer+ as an observer on this object. so that it will receive
# notifications.
#
# +observer+:: the object that will be notified of changes.
# +func+:: Symbol naming the method that will be called when this Observable
#          has changes.
#
#          This method must return true for +observer.respond_to?+ and will
#          receive <tt>*arg</tt> when #notify_observers is called, where
#          <tt>*arg</tt> is the value passed to #notify_observers by this
#          Observable
Add +observer+ as an observer on this object. so that it will receive
notifications.

+observer+:: the object that will be notified of changes.
+func+:: Symbol naming the method that will be called when this Observable
has changes.

This method must return true for +observer.respond_to?+ and will
receive *arg when #notify_observers is called, where
*arg is the value passed to #notify_observers by this
Observable
Add + observer + as an observer on this object . so that it will receive notifications . + observer + :: the object that will be notified of changes . + func + :: Symbol naming the method that will be called when this Observable has changes . This method must return true for + observer . respond_to? + and will receive * arg when #notify_observers is called where * arg is the value passed to #notify_observers by this Observable
def add_observer(observer, func=:update)
    @observer_peers = {} unless defined? @observer_peers
    unless observer.respond_to? func
      raise NoMethodError.new("observer does not respond to `#{func.to_s}'", func.to_s)
    end
    @observer_peers[observer] = func
  end
def add_observer ( observer , func = :update ) @observer_peers = { } unless defined? @observer_peers unless observer . respond_to? func raise NoMethodError . new ( "observer does not respond to `#{func.to_s}'" , func . to_s ) end @observer_peers [ observer ] = func end
Add +observer+ as an observer on this object.
Add + observer + as an observer on this object .
observer
<not_specific>
func
<not_specific>