eval.in

Paste #85264

Ruby — MRI 2.1.0, pasted 3 months ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Car = Class.new do
  def self.start
    print "Started..."
  end
end

TracePoint.trace(:c_return) do |tp|
  puts "'#{tp.event}' event occurred in #{tp.defined_class}##{tp.method_id}"
end

Car.start

Program Output

'c_return' event occurred in #<Class:TracePoint>#trace
Started...'c_return' event occurred in IO#write
'c_return' event occurred in Kernel#print

OK (0.036 sec real, 0.040 sec wall, 9 MB, 19 syscalls)

Fork