Skip to content
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"
avdi commented Nov 1, 2011

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
Something went wrong with that request. Please try again.