Samuel Williams
2018-07-01 00:32:37 UTC
I would like to capture calls to eval.
I tried using trace points which does get pretty close:
@call_trace = TracePoint.new(:c_call) do |trace_point|
if trace_point.method_id == :eval
# How to get args?
end
end
I also tried to override Kernel.eval but that didn't seem to work correctly
either. I might be doing something wrong.
Any ideas or suggestions would be greatly appreciated.
Kind regards,
Samuel
I tried using trace points which does get pretty close:
@call_trace = TracePoint.new(:c_call) do |trace_point|
if trace_point.method_id == :eval
# How to get args?
end
end
I also tried to override Kernel.eval but that didn't seem to work correctly
either. I might be doing something wrong.
Any ideas or suggestions would be greatly appreciated.
Kind regards,
Samuel