Accessing Class Attributes

After a review of some of my Tic Tac Toe code it was recommended to me that I read up on attribute accessors as used in Ruby. These include attr_reader, attr_writer, and attr_accessor. Previously I had manually created my own functions with names like “get_board_class” or “get_io_class” in order to access these attributes that were passed into the Runner class. What attr_reader does is allow one to condense three lines of code down to one. An example of how this works can be found here. Usage of the attr_writer is helpful when trying to manipulate an attribute based on an argument passed into it, and attr_accessor combines the power of both attr_reader and attr_writer to allow for both reading and writing. This Stack Overflow post was helpful in forming my understanding of the concept.