From: Tim Hunter Date: 2002-12-23T07:20:41+09:00 Subject: Re: attr_reader, etc. Check the Pickaxe p. 24, or online http://www.rubycentral.com/book/tut_classes.html, under the heading "Objects and Attributes". There's not really much to say. The attr_reader method creates an instance variable and a method that returns its value. The attr_writer method creates an instance variable and a method that sets its value. The attr_accessor method does both. class MyClass attr_reader :foo end is shorthand for class MyClass def foo @foo end end Similarly, class MyClass attr_writer :foo end is shorthand for class MyClass def foo=(f) @foo=f end end and finally class MyClass attr_accessor :foo end is shorthand for class MyClass def foo @foo end def foo=(f) @foo=f end end On Mon, 23 Dec 2002 05:13:35 +0900, gtzi wrote: > I'm having some confusion with the use of > attr_reader/writer/accessor,etc. > Could someone point me to a document that explains clearly, and in > depth?