Ruby can use global variables.
Global variables are available from everywhere within an application, including inside classes or objects.
You define global variables by putting a dollar sign ($) in front of the variable name, like so:
def basic_method puts $x # ww w . j a v a2 s. c o m end $x = 10 basic_method
$x is defined as a global variable, and you can use it anywhere in your application.
The $ and @ characters that denote global variables and object variables are technically called sigils.