aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notifiers/debug.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-17 18:06:24 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-17 18:06:24 +0100
commit3a579efcd3ea7e4362f7abeb4138c4087e6f13c1 (patch)
tree35a1654cf752f31efb198fbbce0ba8a46a6ba6f4 /lib/mauve/notifiers/debug.rb
parentc8d16b7511969edbde58bc49ef44e0ff63e5cb8f (diff)
Changed method of including the Debug notification module. Now debug! can be
specified in the config to extend that particular instance of a notification method.
Diffstat (limited to 'lib/mauve/notifiers/debug.rb')
-rw-r--r--lib/mauve/notifiers/debug.rb46
1 files changed, 33 insertions, 13 deletions
diff --git a/lib/mauve/notifiers/debug.rb b/lib/mauve/notifiers/debug.rb
index 775364d..417bc94 100644
--- a/lib/mauve/notifiers/debug.rb
+++ b/lib/mauve/notifiers/debug.rb
@@ -12,22 +12,42 @@ module Mauve
base.class_eval do
alias_method :send_alert_without_debug, :send_alert
alias_method :send_alert, :send_alert_to_debug_channels
-
- # Specifying deliver_to_file allows the administrator to ask for alerts
- # to be delivered to a particular file, which is assumed to be perused
- # by a person rather than a machine.
- #
- attr :deliver_to_file, true
-
- # Specifying deliver_to_queue allows a tester to ask for the send_alert
- # parameters to be appended to a Queue object (or anything else that
- # responds to <<).
- #
- attr :deliver_to_queue, true
end
end
+
+ def extended(base)
+ base.instance_eval do
+ alias :send_alert_without_debug :send_alert
+ alias :send_alert :send_alert_to_debug_channels
+ end
+ end
end
-
+
+
+ # Specifying deliver_to_file allows the administrator to ask for alerts
+ # to be delivered to a particular file, which is assumed to be perused
+ # by a person rather than a machine.
+ #
+ def deliver_to_file
+ @deliver_to_file
+ end
+
+ def deliver_to_file=(fn)
+ @deliver_to_file = fn
+ end
+
+ # Specifying deliver_to_queue allows a tester to ask for the send_alert
+ # parameters to be appended to a Queue object (or anything else that
+ # responds to <<).
+ #
+ def deliver_to_queue
+ @deliver_to_queue
+ end
+
+ def deliver_to_queue=(q)
+ @deliver_to_queue = q
+ end
+
def disable_normal_delivery!
@disable_normal_delivery = true
end