Module: TestProf::EventProf::Monitor

Defined in:
lib/test_prof/event_prof/monitor.rb

Overview

Wrap methods with instrumentation

Class Method Summary collapse

Class Method Details

.call(mod, event, *mids) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/test_prof/event_prof/monitor.rb', line 8

def call(mod, event, *mids)
  patch = Module.new do
    mids.each do |mid|
      module_eval "        def \#{mid}(*)\n          TestProf::EventProf.instrumenter.instrument(\n            '\#{event}'\n          ) { super }\n        end\n      SRC\n    end\n  end\n\n  mod.prepend(patch)\nend\n", __FILE__, __LINE__ + 1