why are getters and setters important ruby
In a Ruby class we may want to expose the instance variables (the variables that are defined prefixed by @ symbol) to other classes for encapsulation. ... Getter methods are used to get the value of an instance variable while the setter methods are used to set the value of an instance variable of some class