Trans
1/31/2007 7:46:00 PM
On Jan 31, 6:48 am, "George Ogata" <george.og...@gmail.com> wrote:
> On 1/30/07, Trans <transf...@gmail.com> wrote:
>
> > How does one reflect on alias definitions. Using #method_added only
> > gives you the name of the alias being defined --as if it were a new
> > method. And it's not possible to override 'alias' b/c it's not a real
> > method.
>
> > Ideas?
>
> UnboundMethod#== returns true for aliases, so hopefully:
Good thinking!
> class Module
> def alias?(name)
> name = name.to_s
> instance_method = instance_method(name)
> (instance_methods + private_instance_methods).any? do |n|
> n != name && instance_method(n) == instance_method
> end
> end
> end
[snip]
Nice. I'll give this a whril and put it in Facets, crediting you.
Super Thanks!!!
T.