attr_accessor for array?

Viewed 19355

I want to have an array as a instance variable using attr_accessor.

But isn't attr_accessor only for strings?

How do I use it on an array?

UPDATE:

Eg. If you want:

object.array = "cat"
object.array = "dog"
pp object.array
=> ["cat", "dog"]

Then you have to create those methods yourself?

4 Answers
Related