

Introducing RCapture - Method Hooks in Ruby - cheind
http://cheind.wordpress.com/2010/01/07/introducing-rcapture/
RCapture is a Ruby library that allows placing hooks on methods using a convenient interface. This article introduces RCapture and its features.
======
erikwiffin
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?

~~~
cheind
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

------
jcnnghm
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.

~~~
cheind
I agree, documenting usage of meta-programming is a must. Thanks for your
feedback.

~~~
jcnnghm
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?

~~~
cheind
Hi, yes I'm, and no I haven't :) Can you point me to some links?

