aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/configuration_builders/alert_group.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-23 11:37:38 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-23 11:37:38 +0100
commitca99b0dff974d2fc841d7132d03b3ad1d1bf9b1e (patch)
tree69f949ec5c8a3396222815eacf9109d516de8c84 /lib/mauve/configuration_builders/alert_group.rb
parentc3592bdf6fce6f234de37959c677f75d97b1134d (diff)
People/PeopleLists can now specify individualy notification times/frequencies
* Added PeopleList builder * Added Person#during, PeopleList#during, Person#every, PeopleList#every * Notification now uses #during/#every from the Person/PeopleList if nothing was specified * Added tests
Diffstat (limited to 'lib/mauve/configuration_builders/alert_group.rb')
-rw-r--r--lib/mauve/configuration_builders/alert_group.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/mauve/configuration_builders/alert_group.rb b/lib/mauve/configuration_builders/alert_group.rb
index 56c446d..40e5d9d 100644
--- a/lib/mauve/configuration_builders/alert_group.rb
+++ b/lib/mauve/configuration_builders/alert_group.rb
@@ -14,22 +14,20 @@ module Mauve
# Sets up the notification
#
- # @param [Array] who List of usernames or people_lists to notify
+ # @param [String] who Username or people_list to notify
# @raise [ArgumentError] if a username doesn't exist.
#
# @return [Mauve::Notification] New notification instance.
- def builder_setup(*who)
- who = who.map do |username|
- if @context.people[username]
- @context.people[username]
+ def builder_setup(who)
+ who = if @context.people[who]
+ @context.people[who]
- elsif @context.people_lists[username]
- @context.people_lists[username]
+ elsif @context.people_lists[who]
+ @context.people_lists[who]
- else
- raise ArgumentError.new("You have not declared who #{username} is")
+ else
+ raise ArgumentError.new("You have not declared who #{who} is")
- end
end
@result = Mauve::Notification.new(who, @context.last_alert_group.level)
end