lib/nexaas/auditor/subscriber.rb in nexaas-auditor-1.0.2 vs lib/nexaas/auditor/subscriber.rb in nexaas-auditor-1.0.3

- old
+ new

@@ -3,10 +3,11 @@ module Nexaas module Auditor class Subscriber def self.subscribe_all + validate_subclasses! subscribers = [] subclasses.each do |klass| subscribers << klass.subscribe() end subscribers @@ -31,9 +32,16 @@ private def event_method_name(name) raise "Not Implemented, override in subclass." + end + + # raise error if no app-level subclasses (of StatsSubscriber and + # LogsSubscriber) are found. + def self.validate_subclasses! + raise RuntimeError, + "no subclasses of #{self} found!" if subclasses.empty? end end end end