Name

Pseudo-Variables

Synopsis

In addition to the variables discussed, there are also a few pseudo-variables. Pseudo-variables have the appearance of local variables but behave like constants. Assignments may not be made to pseudo-variables.

self

The receiver object of the current method

true

Value representing true

false

Value representing false

nil

Value representing “undefined”; interpreted as false in conditionals

__FILE__

The name of the current source file

__LINE__

The current line number in the source file

Get Ruby in a Nutshell 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.