From: dblack@... Date: 2006-12-10T22:06:23+09:00 Subject: Re: attr_reader, etc for class variables Hi -- On Sun, 10 Dec 2006, Devin Mullins wrote: > Daniel Finnie wrote: >> Is there such a thing? > Rails' ActiveSupport provides them as cattr_* and mattr_*. For that matter, > they're not that hard to write. For that matter, what Eric said. I'd add that if you write them (and I agree with Eric that instance variables are much better for this; indeed, something is pretty much always better than class variables for everything), it's best to name them something else. "attr" names suggest an attribute of an object, but since class variables are not uniquely associated with any one object, they're not a good fit for recording an attribute. David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org