From: Paul Brannan Date: 2002-07-25T23:25:48+09:00 Subject: Re: A Code Challenge I will first answer your question with a question: *** WHY!?! *** But here's a solution, just for fun (based off the same idea as [ruby-talk:29122]): class Object def append_to_method(method_name, p) m = method(:x) mod = Module.new mod.send(:define_method, :x) do |*args| m.call(*args) p.call(*args) end extend(mod) end end class O def x(a) puts "do something with #{a}" end end o = O.new p = Proc.new { |a| puts "do something else with #{a}" } o.append_to_method(:x, p) o.x("foo") The only disadvantage I can think of is that if x takes a block, you can now no longer pass it a block. I figure this probably isn't a problem anyway since you are appending a proc to it, which cannot take a block. Paul