aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notification.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-23 16:01:44 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-23 16:01:44 +0100
commit6561f886ed03a79ca035a1733816ab97380576d2 (patch)
tree24282c1a9f85a6a1f1eb010df7c421f3c08315bb /lib/mauve/notification.rb
parentca99b0dff974d2fc841d7132d03b3ad1d1bf9b1e (diff)
Persons/PeopleLists can now specify multiple notification preferences.
Diffstat (limited to 'lib/mauve/notification.rb')
-rw-r--r--lib/mauve/notification.rb42
1 files changed, 16 insertions, 26 deletions
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.
#