Module: TestProf::EventProf::Instrumentations::ActiveSupport

Defined in:
lib/test_prof/event_prof/instrumentations/active_support.rb

Overview

Wrapper over ActiveSupport::Notifications

Defined Under Namespace

Classes: Subscriber

Class Method Summary collapse

Class Method Details

.instrument(event) ⇒ Object



34
35
36
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 34

def instrument(event)
  ::ActiveSupport::Notifications.instrument(event) { yield }
end

.subscribe(event, &block) ⇒ Object

Raises:

  • (ArgumentError)


28
29
30
31
32
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 28

def subscribe(event, &block)
  raise ArgumentError, "Block is required!" unless block

  ::ActiveSupport::Notifications.subscribe(event, Subscriber.new(block))
end