From: Dreamcat Four Date: 2009-10-12T22:51:25+09:00 Subject: Re: Class Level inheritable attributes - are we there yet? Dreamcat Four wrote: > David has shown that we should 'extend' and not define any accessor > method. So I guess its the better choice (since pointing out about the > @=nil). Im definately coming around to understand better and appreciate > more David's solution here. Thank you. I would change the following line: - @inheritable_attributes.each do |attr| + inheritable_attributes.each do |attr| Provide the full usage: class MyObject < Object extend ClassLevelInheritableAttributes inheritable_attributes :attr_1, :attr_2, ... end Using extend only once and the feature itself will also propagate to all subclasses. class MySubclass < MyObject inheritable_attributes :attr_3, :attr_4, ... end This means that you could mix into Object, just still left with possible namespace conflict on 1 new method ('inheritable_attributes') as we had discussed earlier. I don't believe we can do anything about that here. Only if defined as an official method would everybody know not to use it. > Best regards, > > dreamcat4 > dreamcat4@gmail.com -- Posted via http://www.ruby-forum.com/.