From: christophe.poucet@... Date: 2005-06-29T23:55:41+09:00 Subject: Patch to delegate.rb Hello, I propose the following patch to delegate.rb. In fact it could be used to replace the entire eval loop that adds methods to Delegator. It is necessary because the delegator that is existent now will not find methods that have been added after a delegator has been created. foo = Object.new def foo.foo puts "foo" end foo.plop # => foo foo2 = SimpleDelegator.new(foo) foo2.plop # => foo def foo.bar puts "bar" end foo.bar # => bar foo2.bar # => NoMethodError The proposed patch will make the last line, "foo2.bar" react as expected, namely... print "bar". The patch is: ------------------------------------------------------------------------------- class SimpleDelegator def method_missing(m, *args) unless @_sd_obj.respond_to?(m) super(m, *args) end @_sd_obj.__send__(m, *args) end end ------------------------------------------------------------------------------- With regards, Christophe