3 ms·
Introducing RCapture - Method Hooks in Ruby
RCapture is a Ruby library that allows placing hooks on methods using a convenient interface. This article introduces RCapture and its features.
- jcnnghm 17y agoThis 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.
- cheind 17y agoI agree, documenting usage of meta-programming is a must. Thanks for your feedback.
- erikwiffin 17y agoI 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?
- cheind 17y agoWell, 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