Method: Kefka::Tracer#trace

Defined in:
lib/kefka.rb

#trace(file_path) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/kefka.rb', line 211

def trace(file_path)
  file = File.open(file_path)

  thread = Thread.new {
    @code = file.read
    toplevel_method = create_toplevel_method(file_path)
    @callstack << Call.new(:method => toplevel_method, :line => 1)
    eval(@code, TOPLEVEL_BINDING, file.path, 1)
  }

  thread.set_trace_func method(:trace_handler).to_proc
  thread.join
end