diff options
Diffstat (limited to 'lib/mauve/configuration_builders/person.rb')
-rw-r--r-- | lib/mauve/configuration_builders/person.rb | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/lib/mauve/configuration_builders/person.rb b/lib/mauve/configuration_builders/person.rb index 1c012f2..c5314c5 100644 --- a/lib/mauve/configuration_builders/person.rb +++ b/lib/mauve/configuration_builders/person.rb @@ -15,29 +15,21 @@ module Mauve is_block_attribute "urgent" is_block_attribute "normal" is_block_attribute "low" - - def all(&block); urgent(&block); normal(&block); low(&block); end - - def password (pwd) - @result.password = pwd.to_s - end - - def holiday_url (url) - @result.holiday_url = url.to_s - end + is_attribute "password" + is_attribute "sms" + is_attribute "holiday_url" + is_attribute "email" + is_attribute "xmpp" + is_attribute "sms" - def email(e) - @result.email = e.to_s - end + # Sets the block for all levels of alert + # + # @param [Block] block + def all(&block); urgent(&block); normal(&block); low(&block); end - def xmpp(x) - @result.xmpp = x.to_s - end - - def sms(x) - @result.sms = x.to_s - end - + # Notification suppression hash + # + # @param [Hash] h def suppress_notifications_after(h) raise ArgumentError.new("notification_threshold must be specified as e.g. (10 => 1.minute)") unless h.kind_of?(Hash) @@ -54,9 +46,14 @@ module Mauve is_builder "person", ConfigurationBuilders::Person + # Method called once a person has been created to check for duplicate names + # + # @param [Mauve::Person] person + # @raise [ArgumentError] if a person has already been declared. + # def created_person(person) name = person.username - raise BuildException.new("Duplicate person '#{name}'") if @result.people[name] + raise ArgumentError.new("Duplicate person '#{name}'") if @result.people[name] # # Add a default notification threshold # |