Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
26 Cards in this Set
- Front
- Back
BEGIN |
Code to be executed unconditionally before program begins via a code block. |
|
END |
Code to be executed right before program termination via code block. |
|
alias |
Creates an alias or duplicate method name for a given method. The original method continues to be accessible via the alias, even if it is overriden. Takes two method-name arguments |
|
and |
n\a |
|
or |
Boolean or. Differs from || in that or has lower precedence |
|
class |
Opens a class definition block. |
|
begin |
A "begin" block allows the use of while and until in modifier position with multi-line statements. "Begin" blocks also serve to scope exception raising and rescue operations. |
|
defined? |
defined? expression tests whether or not expression refers to anything recognizable (literal object, local variable that has been initialized, method name visible from the current scope, etc.). The return value is nil if the expression cannot be resolved. Otherwise, the return value provides information about the expression. |
|
ensure |
Marks the final, optional clause of a begin/end block, generally in cases where the block also contains a rescue clause. The code in the ensure clause is guaranteed to be executed, whether control flows to the rescue block or not. |
|
module |
Opens a module definition block. Takes a constant (the name of the module) as its argument. The definition block starts a new local scope; existing variables are not visible inside the block, and local variables created in the block do not survive the end of the block.
Inside the module definition, self is set to the module object itself. |
|
next |
Skip to the next element of a .each iterator. |
|
not |
Similar in effect to the negating bang (!), but has lower precedence: |
|
redo |
Causes unconditional re-execution of a code block, with the same parameter bindings as the current execution. |
|
rescue |
Designates an exception-handling clause
By default, rescue only intercepts StandardError and its descendants, but you can specify which exceptions you want handled, as arguments. |
|
retry |
Inside a rescue clause, retry causes Ruby to return to the top of the enclosing code (the begin keyword, or top of method or block) and try executing the code again. |
|
self |
n\a |
|
super |
Called from a method, searches along the method lookup path (the classes and modules available to the current object) for the next method of the same name as the one being executed. Such method, if present, may be defined in the superclass of the object‘s class, but may also be defined in the superclass‘s superclass or any class on the upward path, as well as any module mixed in to any of those classes. |
|
until |
The inverse of while: executes code until a given condition is true |
|
undef |
Undefines a given method, for the class or module in which it‘s called. If the method is defined higher up in the lookup path (such as by a superclass), it can still be called by instances classes higher up. |
|
yield |
Called from inside a method body, yields control to the code block (if any) supplied as part of the method call. |
|
:: |
Colon access. The :: is a unary operator that allows: constants, instance methods and class methods defined within a class or module, to be accessed from anywhere outside the class or module. |
|
<=> |
Comparison. Combined comparison operator. Returns 0 if first operand equals second, 1 if first operand is greater than the second and -1 if first operand is less than the second. |
|
=== |
Equality. Used to test equality within a when clause of a case statement. |
|
@ |
Object Scope. Instance variables are available across methods for any particular instance or object. That means that instance variables change from object to object. Instance variables are preceded by the at sign (@) followed by the variable name. |
|
@@ |
Class Scope. Class variables are available across different objects. A class variable belongs to the class and is a characteristic of a class. They are preceded by the sign @@ and are followed by the variable name. |
|
$ |
Global Scope. Class variables are not available across classes. If you want to have a single variable, which is available across classes, you need to define a global variable. The global variables are always preceded by the dollar sign ($) |