From: Florian Gross Date: 2005-01-26T06:20:48+09:00 Subject: Re: Injecting methods from one class into another. George Moschovitis wrote: > Is it possible to write 'inject_method' in Ruby ? Apart from the ways that were already mentioned you can also do this: obj = Class.new { def bar() puts "foo" }.new class Foo define_method(:bar, &obj.method(:bar)) end But note that this is the same as doing this: class Foo define_method(:bar) { obj.method(:bar).call } end I've posted in this thread already that EvilRuby is less restrictive with Method#force_bind, but I don't think that this is needed in your case. (It could however be useful to implement AOP-like stuff.)