On Tue, 22 May 2001, David Thiel wrote:

> I'm just working on learning ruby, and was trying to write a simple
> chatserver, but I guess I'm not understanding how the interpreter tells the
> difference between methods and attributes.  I have an array full of users,
> each one of which has the socket they're connected on as an attribute.  When
> I try and do something simple like "puts users.last.socket" to check and see
> if the socket was assigned properly, it complains that there's no such
> method as socket - I was expecting it to print the socket property.  I may
> just be missing something obvious here, this is how I did it in python.  Any
> help would be appreciated.

You use the class methods "attr", "attr_reader", "attr_writer",
"attr_accessor" to automatically create methods that give access to your
instance variables:

class Person
	attr_reader :socket
end

matju