Read more

Cryptic Ruby Global Variables and Their Meanings

Arne Hartherz
July 17, 2013Software engineer at makandra GmbH

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
Illustration money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
Read more Show archive.org snapshot

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

Posted by Arne Hartherz to makandra dev (2013-07-17 12:19)