From: Joel VanderWerf Date: 2002-09-29T06:12:51+09:00 Subject: Re: alias versus method_missing Lyle Johnson wrote: ... > understand why. But I was trying to figure out if there's an alternative > that gets me what I really wanted (sort-of a "virtual alias"). It's a little less efficient, but this seems to be virtual: class Base def bar; foo; end end There must be a way to use Class#inherited to good effect, but the following doesn't seem to work: class Base def self.inherited(sub) sub.class_eval {alias_method :bar, :foo} end end Derived.new.bar # ==> inside Base#foo However, Derived.class_eval {alias_method :bar, :foo} Derived.new.bar # ==> inside Derived#foo Anyone understand why? (I'm using 1.6.7, and maybe this would be different in a recent 1.7.)