Create a gist now

Instantly share code, notes, and snippets.

Aliasing global variables in Ruby
$magic_word = "xyzzy"
alias $mw $magic_word
$mw = "please"
$mw # => "please"
$magic_word # => "please"

Note that assigning to the alias changes the original. This is what makes the English stdlib possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment