Ruby alias and alias_method
alias
is a keyword and it is lexically scoped. It means it treats self
as the value of self at the time the source code was read.
alias_method
is a method defined in class Module
that treats self
as the value determined at the run time. it can be overridden later to offers more flexibility.
Further reading
Written by Yaodong Zhao
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#