diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-04-27 10:58:36 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-04-27 10:58:36 +0100 |
commit | 5ad5aea6512f43a06e720d0b8e0fbf405d532dca (patch) | |
tree | 12d91d81962bf32972ddd6097c815e2ccdad9cd3 /lib/mauve/person.rb | |
parent | 050d56934033c1cb1c2a6e613c706e3415acbd53 (diff) |
Added default configuration options for a person.
Diffstat (limited to 'lib/mauve/person.rb')
-rw-r--r-- | lib/mauve/person.rb | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb index 929f511..9ea36f7 100644 --- a/lib/mauve/person.rb +++ b/lib/mauve/person.rb @@ -22,10 +22,8 @@ module Mauve @username = username @password = nil - @urgent = lambda { false } - @normal = lambda { false } - @low = lambda { false } - @email = @sms = @xmpp = nil + @urgent = @normal = @low = nil + @email = @sms = @xmpp = nil @notify_when_on_holiday = @notify_when_off_sick = false end @@ -240,14 +238,21 @@ module Mauve return true end - result = NotificationCaller.new( - self, - alert, - [], - # current_alerts, - {:will_suppress => will_suppress, - :was_suppressed => was_suppressed, } - ).instance_eval(&__send__(level)) + result = false + + # + # Make sure the level we want has been defined as a Proc. + # + if __send__(level).is_a?(Proc) + result = NotificationCaller.new( + self, + alert, + [], + # current_alerts, + {:will_suppress => will_suppress, + :was_suppressed => was_suppressed, } + ).instance_eval(&__send__(level)) + end if [result].flatten.any? # |