From: Gavin Sinclair Date: 2003-11-22T23:50:19+09:00 Subject: Re: Method wrapper question (was "stereotyping (was ...)) On Sunday, November 23, 2003, 1:15:04 AM, Christoph wrote: > ts wrote: > ... >> Yes, and this is why I prefer this scheme to >> >> class A >> def a:pre >> end >> >> def a:pre >> end >> >> def a >> end >> end > Agreed 100% - I see no reason for allowing several hooks > in the same class. What difference does it make? Import a method or define it yourself - what's the big deal? What about: require 'example' # Includes class A, which defines A#foo:pre, # but I don't know that, because I just use # the library; I didn't write the damn thing. # I know about A#foo, though, because it's a # really important method I read about in the # RDoc. # Hmmm.... I just want to log calls to A.foo, because something # funny seems to be going on in there. class A def foo:pre(*args) puts "Calling A#foo(#{*args.join(',')})" end end So are you saying I shouldn't do that? Or the author of class A shouldn't define foo:pre, or that I should write a module defining A#foo:pre and include that in A? Gavin