What are the magic $-prefixed variables in Ruby? [closed]

Their name is global variables. There are several different references.

You can get a full list by calling the method Kernel#global_variables

puts global_variables

Ruby also includes a file called “English.rb” in the standard library which provides an in-depth explanation of several global variables.

Also, there’s (an archived version of) “Cryptic Ruby Global Variables and Their Meanings“.

Finally, the Ruby Programming wikibook has a “Predefined Variables” reference.

Leave a Comment