Sha256: f9e532b0b9147a7825b33883ae974f7820fc7badda2001458992d1a0545d3a73
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module CampfireBot module AbsenteeCamper module Notification class NotificationManager def initialize(room, user_config) if user_config.is_a?(Hash) and user_config['notification_methods'] user_config['notification_methods'].each do |notifier, initialization_info| add_notifier Notification.const_get("#{notifier}Notifier".to_sym).new(room, initialization_info) end else # Everyone gets Email notifications if no other notifier is defined. # In this case, user_config is the user_id. Logger.instance.debug "No notification methods defined. Falling back to email notifications." @notifiers = [EmailNotifier.new(room, user_config)] end end def send_notifications(message) @notifiers.each { |notifier| notifier.notify message } end private def add_notifier(notifier) @notifiers ||= [] @notifiers << notifier end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems