Using attr_writer :color is the same as if you had done this:
class Animal
attr_reader :color
attr_writer :color
def initialize(color)
@color = color
end
end
class Animal
attr_reader :color
def color=(color)
@color = color
end
def initialize(color)
@color = color
end
end