This one suffers from the same problem as Massimiliano Mirra's Documentable from last January (which allows for more than just objects) -- it uses class variables which are overridden in subclasses. Perhaps a method that somehow uses class instance variables. -a -- austin ziegler Sent from my Treo -----Original Message----- From: Dossy Date: 03.1.15 13.25 To: ruby-talk / ruby-lang.org (ruby-talk ML) Subj: Re: Doc Strings? On 2003.01.16, Gavin Sinclair <gsinclair / soyabean.com.au> wrote: > On Thursday, January 16, 2003, 4:54:11 AM, Joey wrote: > > > I seem to remember something like this in Ruby, but I can't find it now. In > > Python there is the concept of a doc string; a String of text just inside a > > method of class definition. You can get this string at runtime by asking > > for an attribute called __DOC__. Is there anything equivalent in Ruby? > > No. The closest thing (which isn't even close, because it's not > runtime-accessible, but at least it's "literate programming") is RDoc, > with which you can document each method in the source code, and > extract (painlessly) that documentation into HTML and other targets. Or, try this: class Module def __doc__(x = nil) if not x.nil? @@doc = x end @@doc end end class Foo __doc__ "some docs for class Foo" # rest of Foo stuff here end f = Foo.new f.class.__doc__ # => "some docs for class Foo" Foo.__doc__ # => "some docs for class Foo" I think this was posted to the ML a few months ago. -- Dossy -- Dossy Shiobara mail: dossy / panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)