summaryrefslogtreecommitdiff
path: root/fake-service/lib/pixelated_service/combined_observer.rb
blob: a300f6e6c382349ef747b35d866ad230bd34e3bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module PixelatedService
  class CombinedObserver
    def initialize(*observers)
      @observers = observers
    end

    def <<(observer)
      @observers << observer
    end

    def mail_added(mail)
      @observers.each { |o| o.mail_added(mail) }
    end

    def mail_removed(mail)
      @observers.each { |o| o.mail_removed(mail) }
    end

    def mail_updated(before, after)
      @observers.each { |o| o.mail_updated(before, after) }
    end
  end
end