Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Instead of subtracting 10, since the caller method provides filenames, just before the .grep you could call .reject to filter out all the framework code, or perhaps .take_while to stop when you've hit a certain point. (Those would also work for filtering our places you want to turn off tracing.)

Another less hacky but usually slower solution would be the over-powered but under-used set_trace_func, which would give you all the flexibility you need, although I don't know if the trace function is thread-safe (on a phone, rubydoc is a bit hard to search from here).

But, certainly, point taken about it losing its power to illustrate those techniques.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: