Should I use alias or alias_method?

alias_method can be redefined if need be. (it’s defined in the Module class.)

alias‘s behavior changes depending on its scope and can be quite unpredictable at times.

Verdict: Use alias_method – it gives you a ton more flexibility.

Usage:

def foo
  "foo"
end

alias_method :baz, :foo

Leave a Comment