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/people_list.rb | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/mauve/configuration_builders/people_list.rb (limited to 'lib/mauve/configuration_builders/people_list.rb') diff --git a/lib/mauve/configuration_builders/people_list.rb b/lib/mauve/configuration_builders/people_list.rb new file mode 100644 index 0000000..e5f6715 --- /dev/null +++ b/lib/mauve/configuration_builders/people_list.rb @@ -0,0 +1,41 @@ +# encoding: UTF-8 +require 'object_builder' +require 'mauve/people_list' +require 'mauve/configuration_builder' + +module Mauve + module ConfigurationBuilders + + class PeopleList < ObjectBuilder + + def builder_setup(label, list) + @result = Mauve::PeopleList.new(label) + @result += list + end + + is_block_attribute "during" + is_attribute "every" + + end + end + + class ConfigurationBuilder < ObjectBuilder + + is_builder "people_list", ConfigurationBuilders::PeopleList + + # Method called once a people_list has been created to check for duplicate labels + # + # @param [Mauve::PeopleList] people_list + # + def created_people_list(people_list) + label = people_list.label + if @result.people_lists.has_key?(label) + _logger.warn("Duplicate people_list '#{label}'") + @result.people_lists[label] += people_list.list + else + @result.people_lists[label] = people_list + end + end + + end +end -- cgit v1.2.1