From: William Djaja Tjokroaminata Date: 2002-09-29T08:10:06+09:00 Subject: Re: alias versus method_missing Hi Lyle, This is just an example; I am sure you can improve it further according to your need. Here we use one of the powers of scripting/interpreted language, which is that we can generate code on-the-fly. Regards, Bill ------------------- class Base def foo puts "inside Base#foo" end end class Derived < Base def foo puts "inside Derived#foo" end end class Final < Derived def foo puts "inside Final#foo" end end def set_alias (child) until child == Object eval "class #{child.name}\n alias bar foo\n end" child = child.superclass end end set_alias (Final) Final.new.bar Derived.new.bar Base.new.bar =========================================================================== Lyle Johnson wrote: > William Djaja Tjokroaminata wrote: >> How about starting with the great-great-grandchild, and then 'eval'ing the >> alias all the way up to the root? > OK, I am too dense to understand what you're suggesting ;) Could you > maybe give me a brief example (in code) of the approach you're suggesting?