new(q, r, s, t) Class Public methods
set_get_line_procs(file_name, p = proc) Class Public methods Register an event handler p which is called everytime a line in file_name is executed. Example: Tracer.set_get_line_procs("example.rb", lambda { |line| puts "line number executed is #{line}" })
on() Class Public methods Start tracing Example Tracer.on # code to trace here Tracer.off You can also pass a block: Tracer.on { # trace everything in this block }
off() Class Public methods Disable tracing
add_filter(p = proc) Class Public methods Used to filter unwanted trace output Example which only outputs lines of code executed within the Kernel class: Tracer.add_filter do |event, file, line, id, binding, klass, *rest| "Kernel" == klass.to_s end
self() Instance Public methods Return the trace object during event Same as #binding: trace.binding.eval('self')
return_value() Instance Public methods Return value from :return, c_return, and b_return event
raised_exception() Instance Public methods Value from exception raised on the :raise event
path() Instance Public methods Path of the file being run
method_id() Instance Public methods Return the name of the method being called
Page 521 of 2275