Sha256: d94bd460796b8f63c692fe5b7ccc46bb57025f63416a3d995f28cfa1db3eef29
Contents?: true
Size: 619 Bytes
Versions: 17
Compression:
Stored size: 619 Bytes
Contents
module Betterlog module Notifiers class_attr_accessor :notifiers self.notifiers = Set[] def self.register(notifier) notifier.respond_to?(:notify) or raise TypeError, "notifier has to respond to notify(message, hash) interface" notifiers << notifier self end def self.notify(event) notifiers.each do |notifier| notifier.notify(event.notify?, event.as_json) end end def self.context(data_hash) notifiers.each do |notifier| notifier.respond_to?(:context) or next notifier.context(data_hash) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems