In ruby, if I have a class greet
and has method say_hi
that prints out "Hello #{@name}"
when name is a instance variable of class greet
, and I allow access to @name
by adding in the attr_accessor :name
, so now I can directly change @name
.
But how do I remove this attr_accessor
if I no longer want people to be able to change @name
directly?