From: ara.t.howard@... Date: 2006-10-18T02:33:24+09:00 Subject: Re: metaprogramming surprise? On Wed, 18 Oct 2006, J2M wrote: > To achieve what you were trying you may want to look at the class > extensions in rails where there are simple class level accessors and > inheritable_class accessors that give each inherited class it's own > copy of the accessors from the parent class. > > http://dev.rubyonrails.org/svn/rails/branches/stable/activesupport/lib/active_support/core_ext/class/ attributes.rb is 42 lines of code and does all of that too, plus up front or deferred initialisation. harp:~ > cat a.rb require 'rubygems' require 'attributes' class A class << self attribute 'a' => 42 attribute('classname'){ self.name } end end class B < A end p A.a p B.a p A.classname p B.classname harp:~ > ruby a.rb 42 42 "A" "B" -a -- my religion is very simple. my religion is kindness. -- the dalai lama