Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between alias method and alias symbol?

Tags:

ruby

I read some aliasing method like this:

alias :original_method :method

That looks like symbols in ruby for me. What's the difference if i typed that alias like this:

alias original_method method

Will the result be different?

like image 951
Mas Bagol Avatar asked Sep 17 '14 13:09

Mas Bagol


1 Answers

There doesn't seem to be a difference, from the documentation:

The alias keyword is most frequently used to alias methods. When aliasing a method you can use either its name or a symbol:

alias new_name old_name
alias :new_name :old_name
like image 176
Stefan Avatar answered Oct 13 '22 12:10

Stefan