Module: Betterlog::Notifiers
- Defined in:
- lib/betterlog/notifiers.rb
Class Method Summary collapse
Class Method Details
.context(data) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/betterlog/notifiers.rb', line 23 def self.context(data) notifiers.each do |notifier| notifier.respond_to?(:context) or next notifier.context(data) end end |
.notify(event) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/betterlog/notifiers.rb', line 15 def self.notify(event) event.notify? or return notifiers.each do |notifier| context(event.as_json) notifier.notify(event[:message], event.as_json) end end |
.register(notifier) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/betterlog/notifiers.rb', line 8 def self.register(notifier) notifier.respond_to?(:notify) or raise TypeError, "notifier has to respond to notify(message, hash) interface" notifiers << notifier self end |