Class: Nexaas::Auditor::Subscriber
- Inherits:
-
Object
- Object
- Nexaas::Auditor::Subscriber
show all
- Defined in:
- lib/nexaas/auditor/subscriber.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.pattern ⇒ Object
21
22
23
|
# File 'lib/nexaas/auditor/subscriber.rb', line 21
def self.pattern
raise "Not Implemented, override in subclass and provide a regex or string."
end
|
.subscribe(options = {}) ⇒ Object
16
17
18
19
|
# File 'lib/nexaas/auditor/subscriber.rb', line 16
def self.subscribe(options={})
subscriber = options.fetch(:subscriber) { ::ActiveSupport::Notifications }
subscriber.subscribe(pattern, new)
end
|
.subscribe_all ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/nexaas/auditor/subscriber.rb', line 7
def self.subscribe_all
validate_subclasses!
subscribers = []
subclasses.each do |klass|
subscribers << klass.subscribe()
end
subscribers
end
|
Instance Method Details
#call(name, start, finish, event_id, payload) ⇒ Object
Dispatcher that converts incoming events to method calls.
26
27
28
29
30
31
|
# File 'lib/nexaas/auditor/subscriber.rb', line 26
def call(name, start, finish, event_id, payload)
method_name = event_method_name(name)
if respond_to?(method_name)
send(method_name, name, start, finish, event_id, payload)
end
end
|