Module: Collective::Utilities::Observeable

Included in:
Worker
Defined in:
lib/collective/utilities/observeable.rb

Instance Method Summary collapse

Instance Method Details

#add_observer(o) ⇒ Object



5
6
7
8
# File 'lib/collective/utilities/observeable.rb', line 5

def add_observer(o)
  o.focus(self)
  (@observers ||= []).push(o)
end

#notify(*details) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/collective/utilities/observeable.rb', line 10

def notify( *details )
  if @observers then
    @observers.each do |observer|
      observer.notify( self, *details )
    end
  end
end