From: Verno Miller Date: 2006-09-16T21:59:29+09:00 Subject: Re: Ruby keywords vs methods >Posted by Chris Roos (Guest) >on 16.09.2006 01:47 >Hi, >I attended Jim Weirich's talk at Rails Conf on Friday. It was about >thoughtful library design and contained a section on ways to mitigate >risk when re-opening standard libraries. >... >It struck me that it might be quite useful to wrap this up and apply >it to all methods defined for [a] given class[es]. Unfortunately, it >appears not to be (completely) possible. I thought we might be able >to use the method_added hook, but this gets fired after the method >definition. We need something to fire right before the method >definition. As def is a keyword and not a method, we can't override >and add to the default behaviour. Note, that we can, however, do this >with define_method. Maybe also check out metaprogramming hacks similar to the "Alternative to inheriting from Array" ( http://www.bigbold.com/snippets/posts/show/2573 )! -- Posted via http://www.ruby-forum.com/.