Sha256: 3a6b198e071ceadeb79237a963ae167519317c1c07532d3031d12d0239c1e8dd
Contents?: true
Size: 908 Bytes
Versions: 1
Compression:
Stored size: 908 Bytes
Contents
#!/usr/bin/env ruby require 'ostruct' module Flapjack class Notifier attr_reader :recipients, :log, :notifiers def initialize(opts={}) @log = opts[:logger] raise "you have to specify a logger" unless @log @recipients = (opts[:recipients] || []) @notifiers = [] if opts[:notifiers] opts[:notifiers].each do |n| @notifiers << n @log.info("using the #{n.class.to_s.split("::").last} notifier") end else @log.warning("there are no notifiers") end end # FIXME: use opts={} convention def notify!(result, event) @notifiers.each do |n| @recipients.each do |recipient| @log.info("Notifying #{recipient.name} via #{n.class} about check #{result.id}") n.notify(:result => result, :who => recipient, :event => event) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flapjack-0.4.12 | lib/flapjack/notifier.rb |