From: ara.t.howard@... Date: 2006-10-26T14:33:53+09:00 Subject: Re: Popularity Contest: Initializing Class-Level Instance Variables On Thu, 26 Oct 2006, Phrogz wrote: > Subclassing a class that uses class-level instance variables requires that > you initialize them for subclasses. Which of the following three techniques > do you prefer? harp:~ > cat a.rb require 'rubygems' require 'attributes' class A class << self attribute 'a' => 42 attribute(:b){ "__#{ self.name }__" } # deferred initialization! end end class B < A end p A.a p A.b p B.a p B.b harp:~ > ruby a.rb 42 "__A__" 42 "__B__" one can use traits too - but it's pretty heavy if you don't need all it's features. btw, traits was writtern to solve __exactly__ this common problem. regards. -a -- my religion is very simple. my religion is kindness. -- the dalai lama