From: "ara.t.howard" Date: 2008-11-15T11:56:21+09:00 Subject: Re: Overriding methods in a class using a mixin On Nov 14, 2008, at 3:02 PM, James Coglan wrote: > Hi list, > I just had this idea and thought I'd share it in case someone can > improve > upon it, make it more robust. Basically, I've run into a situation a > few > times where I want to override methods in a class but retain access > to old > implementations, the sort of thing people like to use > alias_method_chain > for. I tend to favour this approach, though: > > class Foo > meth = instance_method(:foo) > define_method(:foo) do |some, args| > result = meth.bind(self).call(some, args) > # do extra stuff... > end > end alias_method_chain_is_crap_because_it_leads_to_madness_like_this your method is *ok* but it chops the method in half - dropping blocks on the floor check this out http://drawohara.com/post/7241442/ruby-saner-way-to-redefine-methods a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama