Good points learned during the course of time.
Lesson 1 (Ruby Fundamentals)
-
The symbol form of operators &&, || have higher precedence than assignment operator = while the assignment operator = has higher precedence than or, and, not.
-
The reflective method local_variables of module Kernel lists the local variables in that context as an array of strings.
-
arg1 || arg2 returns arg1 unless arg1 is false. A common idiom is to use || to assign a value to a variable only if that variable isn’t already set – @variable = @variable || “default value”
-
In Ruby, everything is true except the reserved words false and nil.
Lesson-2(Ruby Methods):
-
The statement arg1=”x”, arg2=”y”, arg3=”z” is equivalent to arg1 = [x, arg2="y", arg3="z"].
- Variable have higher precedence than methods. When there’s a “name-clash” Ruby uses first the variable. One can coerce Ruby to call the method by issuing name().
Lesson-3, 4(Blocks/Files):
- Blocks are not objects, but they can be converted into objects of class Proc. This can be done by calling the lambda method of the module Kernel.The class Proc has a method call that invokes the block.
- The expression #{} is evaluated in double quote strings and not in single quote strings.
Lesson-6 (Open Classes):
- In Ruby, we can always add methods to an existing class. The good practice is to create a subclass of the original class and override parent’s method or add new one.
Advertisement

Good to see that you too have started maintaining a blog. All the very best.