Variáveis globais especiais
Como sempre esqueço o que é cada tipo de variável global especial, resolvi colocar na minha memória para sempre!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$! # Lastest error message
$@ # Location of error
$_ # String last read by `gets`
$. # Line number last read by interpreter
$& # String last matched by regexp
$~ # The last regexo match, as an array of subexpressions
$n # The nth subexpressions in the last match (like as `$~[n]`)
$= # Case-insensitivity flag
$/ # Input record separator
$\ # Output record separator
$0 # The name of the ruby script file
$* # The command line arguments
$$ # Interpretter's process ID
$? # Exit status of last executed child process
;)
Referência: Ruby User’s Guide - Global variables