Going H.A.M. with “The Well-Grounded Rubyist”
This is more of a personal goal of mine/experiment to see if via note taking and carefully summing up parts of the book I can gain a clearer understanding of Ruby. But of course, I would like to share with whomever is interested.
The programming book I will be diving into is “The Well-Grounded Rubyist” by David A. Black.
It’s a book that has been recommended to me over, and over again. The goal is to read the book for at least 1 hour a week and share my findings on this post. In other words I will be updating this post on the reg :)
Here we go, I hope you all enjoy. It’s going to be a long/interesting ride.
From here on out it will be all my notes from the book…
“You need a sense of what an object is in Ruby and what a method call looks like.”
- Variables; -Local, Instance, -Class, -Global
- Method names
Objects can be composed of integers, strings, and arrays. Every Object is capable of receiving messages. Each message corresponds to a method.
How do you send a message to an object? Via the dot operator. Any message to the right of the dot is sent to the object on the left of the dot. For example;
x = “100”.to_i
The message to_i is being sent to the string “100”. The string “100" is also known as the receiver. Another way to word this would be the method to_i is being called on the string “100”.
The ability of object to adopt behaviors that their class didn’t give them is one of the most central defining principles of the design of Ruby as a language.
Print vs. Puts
Require vs Load