Alias_method for static method

Hi,
I was wondering if it is possible to create aliases for class methods,
as alias_method seems to work only for instance methods.
Thanks in advance

Hi –

On Sat, 16 Jun 2007, Borja Martín wrote:

Hi,
I was wondering if it is possible to create aliases for class methods, as
alias_method seems to work only for instance methods.
Thanks in advance

Class methods are singleton methods defined in a class’s singleton
class. So, to get into the right scope you would do:

class << YourClass

and then you can use alias and/or alias_method.

David

Thanks a lot, it worked like a charm.

[email protected] escribió:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs