"A method that you define at the top level is stored as a private instance method of the Object class. Defining private instance methods of Object has some interesting implications. First, these methods not only can but must be called in bareword style. Second, private instance methods of Object can "
"A protected method is like a slightly kinder, gentler private method. The rule for pro- tected methods is as follows: you can call a protected method on an object x, as long as the default object (self) is an instance of the same class as x or of an ancestor or descendant class of x’s class. This ru"
"If you declare dog_years= private, you can call it with a receiver—as long as the receiver is self. It can’t be another reference to self; it has to be the keyword self."
"Constant lookup—the process of resolving a constant identifier, finding the right match for it—bears a close resemblance to searching a filesystem for a file in a particular directory. For one thing, constants are identified relative to the point of execution. the :: in front of a constant means “st"
"When the Ruby parser sees the sequence identifier, equal-sign, value, as in this expression x = 1 it allocates space for a local variable called x. The creation of the variable—not the assignment of a value to it, but the internal creation of a variable—always takes place as a result of this kind of"
"Every Ruby object has a case equality method called === (three equal signs, sometimes called the “threequal” operator). The outcome of calling the === method determines whether a when clause has matched."
"Blocks, in other words, have access to the variables that already exist when they're created. However, block parameters (the variable names between the pipes) behave differently from non-parameter variables. If you have a variable of a given name in scope and also use that name as one of your block "
"Coming full circle, remember that nil has a boolean value of false. nil and false are the only two objects that do. They’re not the only two expressions that do; 100 < 50 has a boolean value of false, because it evaluates to the object false. But nil and false are the only two objects in Ruby with a"