Hacker News new | ask | show | jobs
Introducing RCapture - Method Hooks in Ruby (cheind.wordpress.com)
5 points by cheind 6009 days ago
RCapture is a Ruby library that allows placing hooks on methods using a convenient interface. This article introduces RCapture and its features.
2 comments

I like it, and see a lot of uses for RCapture during the debugging stage. However, I can't think of a situation off the top of my head where it would be preferable to add a hook to a method rather than change the method itself. As the creator, I'm assuming you had some use cases in mind?
Well, yes: decoupling concerns and common aspects of methods. Adding logging to third party libraries for instance. Another one was custom profiling and statistics. You might find your very own use cases by having a look at the examples.

Christoph

This looks like it could be pretty useful. As with all meta-programming though, if you're going to use this it's probably a good idea to make it clear in your comments and log files. It can be very difficult to debug.
I agree, documenting usage of meta-programming is a must. Thanks for your feedback.
Are you the creator? If you are, have you considered incorporating some of the hacks that will show meta programming line numbers in stack traces?
Hi, yes I'm, and no I haven't :) Can you point me to some links?