From: Stephan Dale Date: 2007-07-30T02:57:17+09:00 Subject: rdoc and virtual attributes I've been trying to get rdoc to document virtual attributes as though they weren't virtual. The solution seems to be to use an attr_reader / attr_writer as an anchor for the documentation with the :nodoc: modifier on the getter / setter methods, like so: class ClassName # Documentation for virtual_var. attr_writer :virtual_var def virtual_var # :nodoc: # "get" virtual_var end def virtual_var=(whatever) # :nodoc: # "set" virtual_var end end Doing this results in rdoc documenting the virtual attribute alongside the normal attributes and not documentating the virtual attribute getter / setter methods. So, to the reader, the fact that the attribute is virtual is completely hidden. The main problem with this approach seems to be that it places a greater responsibility on the programmer to ensure that there is no mismatch between what a ClassName instance reports its variable to be and what the getter method says it is. 1. Are there any other potential problems with using this approach? 2. Is there a better way to do it? -- Posted via http://www.ruby-forum.com/.