325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
# File 'lib/hyper_trace/hyper_trace.rb', line 325
def add_hyper_trace_method(method, config)
def_method = config.instrument_class? ? :define_singleton_method : :define_method
config.klass.send(def_method, method) do |*args, &block|
block_string = ' { ... }' if block
if HyperTrace.formatting?
begin
send "__hyper_trace_pre_#{method}", *args, &block
rescue Exception
"???"
end
else
begin
HyperTrace.format_head(self, method, args) do
HyperTrace.format_instance_internal(self)
HyperTrace.breakpoint(:enter, config, method, args, self)
result = HyperTrace.call_original self, method, *args, &block
HyperTrace.format_result(result)
HyperTrace.breakpoint(:exit, config, method, args, self, result)
result
end
rescue Exception => e
HyperTrace.format_exception(e)
debugger unless HyperTrace.exclusions[self.class][:rescue].include? :method
raise e
end
end
end
end
|