From: Stephan Dale Date: 2007-07-31T20:54:19+09:00 Subject: Re: rdoc and virtual attributes I'm just worried that by using the attr_ methods where you'd not normally do so, simply for documentaion purposes, increases the risk that you forget their programmatic effects. e.g. I've defined a virtual attribute called foo and I've used attr_writer to document it as a normal attribute. Problem is that I've forgotten to override the setter. By inspection we can see that the use of foo= sets @foo, but foo doesn't get @foo, hence showing that foo is a virtual attribute and exposing some of the underlying implementation. class Bar # foo isn't a virtual attribute, honest! attr_writer :foo # oh yes it is. def foo # :nodoc: @foo+1 end end irb(main):011:0> b = Bar.new => # irb(main):012:0> b.foo = 1 => 1 irb(main):013:0> b => # irb(main):014:0> b.foo => 2 I was hoping that there was a way of flagging a method as representing a virtual attribute rather than having to rely on the attr_ methods. e.g. def foo # :virtual: -- Posted via http://www.ruby-forum.com/.