The following keywords are used by Ruby.
The script encoding of the current file. See Encoding.
The line number of this keyword in the current file.
The path to the current file.
Runs before any other code in the current file. See miscellaneous syntax
Runs after any other code in the current file. See miscellaneous syntax
Creates an alias between two methods (and other things). See modules and classes syntax
Short-circuit Boolean and with lower precedence than
&&
Starts an exception handling block. See exceptions syntax
Leaves a block early. See control expressions syntax
Starts a case
expression. See control expressions syntax
Creates or opens a class. See modules and classes syntax
Defines a method. See methods syntax
Returns a string describing its argument. See miscellaneous syntax
Starts a block.
The unhandled condition in case
, if
and
unless
expressions. See control expressions syntax
An alternate condition for an if
expression. See control
expressions syntax
The end of a syntax block. Used by classes, modules, methods, exception handling and control expressions.
Starts a section of code that is always run when an exception is raised. See exceptions syntax
Boolean false. See literals
A loop that is similar to using the each
method. See control
expressions syntax
Used for if
and modifier if
statements. See
control expressions syntax
Used to separate the iterable object and iterator variable in a
for
loop. See control expressions syntax It also serves as a
pattern in a case
expression. See pattern matching
Creates or opens a module. See modules and classes syntax
Skips the rest of the block. See control expressions syntax
A false value usually indicating “no value” or “unknown”. See literals
Inverts the following boolean expression. Has a lower precedence than
!
Boolean or with lower precedence than ||
Restarts execution in the current block. See control expressions syntax
Starts an exception section of code in a begin
block. See
exceptions syntax
Retries an exception block. See exceptions syntax
Exits a method. See methods syntax. If met in top-level scope, immediately stops interpretation of the current file.
The object the current method is attached to. See methods syntax
Calls the current method in a superclass. See methods syntax
Indicates the end of conditional blocks in control structures. See control expressions syntax
Boolean true. See literals
Prevents a class or module from responding to a method call. See modules and classes syntax
Used for unless
and modifier unless
statements.
See control expressions syntax
Creates a loop that executes until the condition is true. See control expressions syntax
A condition in a case
expression. See control expressions
syntax
Creates a loop that executes while the condition is true. See control expressions syntax
Starts execution of the block sent to the current method. See methods syntax