From: Gavin Sinclair Date: 2004-01-15T06:49:51+09:00 Subject: Re: What object-configuration approach to use? On Thursday, January 15, 2004, 2:32:39 AM, Mauricio wrote: >> - I'd prefer the writers be RDoc'ed anyway so I can see which >> attributes I can set in the initializer. > On second thought me too :) I guess I'd just do > class A > attr_reader :foo, :bar > # use only with A.new { |o| ... } > attr_writer :foo, :bar > ... > end > since rdoc will use the same description for all the 'attributes' > defined in the same attr_* call. That's some good thinking. The RDoc output for that is unpleasant, though (no fault of RDoc). The attributes look like this (sample docs added): bar [W] use only with A.new { |o| � } bar [R] Represents the 'bar' of the object. foo [W] use only with A.new { |o| � } foo [R] The user's 'foo'. That's obviously too crowded and repetitive. At the end of the day, I just think "stuff it, I don't like making things accessors when readers will do, but since I'm making the class easier to use, I expect users to be more careful in return." Cheers, Gavin