Cryptic Ruby Global Variables and Their Meanings

Updated . Posted . Visible to the public.

The linked page lists and explains global Ruby "dollar" variables, such as:

  • $: (load path)
  • $* (ARGV)
  • $? (Last exit status)
  • $$ (PID)
  • $~ (MatchData from last successful match)
  • ...and many more you'll need when reading weird code.

Regex

  • $~ (last MatchData)
  • $1 $2 $3 $4 (match groups from the last pattern match)
  • $& (last matched string)
  • $+ (last match group)
  • `$`` (the string before the last match)
  • $' (the string after the last match

See this extensive list of variables Show archive.org snapshot .

Profile picture of Arne Hartherz
Arne Hartherz
Last edit
Dominik Schöler
Keywords
special
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2013-07-17 10:19)