Create a gist now

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Show comment
Hide comment
@avdi

avdi Nov 1, 2011

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

Owner

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