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. |
Get Ruby Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.