Q. What is the purpose of the Module#attr_reader, Module#attr_writer, and Module#attr_accessor methods in Ruby?
-
(A)
They define getter, setter, and both getter and setter methods for instance variables respectively
-
(B)
They define methods for reading, writing, and both reading and writing instance variables respectively
-
(C)
They define methods for reading instance variables, writing class variables, and both respectively
-
(D)
They define methods for reading, writing, and both reading and writing class variables respectively
β
Correct Answer: (A)
They define getter, setter, and both getter and setter methods for instance variables respectively