> I even don't know what attr_accessor is.
attr_accessor :colour in your class would allow you do to this:
class Dog
attr_accessor :colour
end
jimmy = Dog.new
jimmy.colour = 'brown'
puts jimmy.colour # "brown"
jimmy.colour = 'black'
puts jimmy.colour # "black"
As far as i know the name attr_accessor is chosen because it unites both
attr_reader (getter method) and attr_writer (setter method). (There also
exists attr :foo but I never use attr )
--
Posted via http://www.ruby-forum.com/.