Understanding Accessors in Ruby

One thing that puzzled me as a newbie (disclaimer: I still am) are accessors in Ruby, more commonly known as setters and getters or explicitly described as attr_reader, attr_writer and attr_accessor. Now let’s dive into the code first and describe the concepts of accessors after we’re done with coding. Initializing a Class Let’s say we want to create a class to resemble a Person with a name, and finally let’s try to access that name outside the class:...

<span title='2018-02-25 10:04:26 +0000 UTC'>February 25, 2018</span>&nbsp;·&nbsp;5 min&nbsp;·&nbsp;Franccesco Orozco