From: Robert Dober Date: 2007-07-31T00:35:35+09:00 Subject: Re: Introspection on aliased methods? On 7/30/07, Farhad Farzaneh wrote: > Is there a way to determine what equivalent methods are, that is, what > has been aliased to what on an object or class? > -- > Posted via http://www.ruby-forum.com/. > > Hmm I do not know how to identify which name was used originally and which was aliased but if that does not matter you can do 24/122 > irb irb(main):001:0> class A irb(main):002:1> def x; end irb(main):003:1> def y; end irb(main):004:1> alias_method :z, :x irb(main):005:1> end => A irb(main):006:0> A.instance_method(:x) == A.instance_method(:y) => false irb(main):007:0> A.instance_method(:x) == A.instance_method(:z) => true irb(main):008:0> you could loop over all instance_methods of a class, or do the same stuff with method for any object. HTH Robert -- [...] as simple as possible, but no simpler. -- Attributed to Albert Einstein