From ca99b0dff974d2fc841d7132d03b3ad1d1bf9b1e Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 23 Apr 2012 11:37:38 +0100 Subject: 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 --- lib/mauve/configuration_builders/alert_group.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib/mauve/configuration_builders/alert_group.rb') 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 -- cgit v1.2.1