diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-04-23 11:37:38 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-04-23 11:37:38 +0100 |
commit | ca99b0dff974d2fc841d7132d03b3ad1d1bf9b1e (patch) | |
tree | 69f949ec5c8a3396222815eacf9109d516de8c84 /lib/mauve/configuration_builders/people_list.rb | |
parent | c3592bdf6fce6f234de37959c677f75d97b1134d (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/people_list.rb')
-rw-r--r-- | lib/mauve/configuration_builders/people_list.rb | 41 |
1 files changed, 41 insertions, 0 deletions
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 |