Predefined Variables
Table 3 lists all of Ruby’s predefined variables.
Table 3. Predefined variables
Predefined variable | Description |
|---|---|
| The exception information message containing the last exception raised. |
| The stack backtrace of the last exception, retrievable via |
| The string matched by the last successful pattern match in this scope, or |
| String preceding whatever was matched by the last successful pattern match in the current scope, or |
| String following whatever was matched by the last successful pattern match in the current scope, or |
| Last bracket matched by the last successful search pattern, or |
| Subpattern from the corresponding set of parentheses in the last successful pattern matched, not counting patterns matched in nested blocks that have been exited already, or |
| Information about the last match in the current scope. |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access