From 6561f886ed03a79ca035a1733816ab97380576d2 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 23 Apr 2012 16:01:44 +0100 Subject: Persons/PeopleLists can now specify multiple notification preferences. --- lib/mauve/notification.rb | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'lib/mauve/notification.rb') diff --git a/lib/mauve/notification.rb b/lib/mauve/notification.rb index 3c7270e..d06e03a 100644 --- a/lib/mauve/notification.rb +++ b/lib/mauve/notification.rb @@ -182,17 +182,19 @@ module Mauve # at a particular alert level, on a periodic basis, and optionally under # certain conditions specified by a block of code. # - class Notification < Struct.new(:person, :level) + class Notification + + attr_reader :during, :every, :level, :person # Set up a new notification # # @param [Array] person List of Mauve::Person to notify # @param [Symbol] level Level at which to notify - def initialize(person, level) - self.level = level - self.every = nil - self.during = nil - self.person = person + def initialize(person) + @person = person + @during = nil + @every = nil + @level = nil end # @return [String] @@ -203,34 +205,22 @@ module Mauve # @return Log4r::Logger def logger ; Log4r::Logger.new self.class.to_s ; end - # - # - # - def during - @during ||= person.during - end - - # - # - # def during=(arg) @during = arg end - # - # - # - def every - @every ||= person.during - end - - # - # - # def every=(arg) @every = arg end + def level=(arg) + @level = arg + end + + def person=(arg) + @person = arg + end + # Push a notification on to the queue for this alert. The Mauve::Notifier # will then pop it off and do the notification in a separate thread. # -- cgit v1.2.1