Skip to content

Commit

Permalink
don't use a global list of recipients, as they'll be passed in when a…
Browse files Browse the repository at this point in the history
… notification needs to be sent
  • Loading branch information
auxesis committed Dec 24, 2009
1 parent c949be4 commit 9a681d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/flapjack/notifier_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
module Flapjack
class NotifierEngine

attr_reader :recipients, :log, :notifiers
attr_reader :log, :notifiers

def initialize(opts={})
@log = opts[:log]
raise "you have to specify a logger" unless @log
@recipients = (opts[:recipients] || [])

@notifiers = []
if opts[:notifiers]
Expand All @@ -24,14 +23,15 @@ def initialize(opts={})
end

def notify!(options={})
result = options[:result]
event = options[:event]
result = options[:result]
event = options[:event]
recipients = options[:recipients]

raise ArgumentError, "A result + event were not passed!" unless result && event

@notifiers.each do |n|
@recipients.each do |recipient|
@log.info("Notifying #{recipient.name} via #{n.class} about check #{result.id}")
recipients.each do |recipient|
@log.info("Notifying #{recipient.name} via #{n.class} about check #{result.check_id}")
n.notify(:result => result, :who => recipient, :event => event)
end
end
Expand Down

0 comments on commit 9a681d9

Please sign in to comment.