On Wed, Nov 19, 2008 at 11:36 AM, Michael Fellinger <m.fellinger / gmail.com> wrote: > On Wed, Nov 19, 2008 at 7:12 PM, Jesù¸ Gabriel y GaláÏ > <jgabrielygalan / gmail.com> wrote: > Little different style maybe: > > class A > @subclasses = [] > def self.inherited(into) @subclasses << into end > def self.subclasses() @subclasses end > end Yep, much cleaner :-). I made a mess while I was typing in irb about closing the << self early, and forgetting to initialize the array, so that was the result. I probably wanted to type this: irb(main):001:0> class A irb(main):002:1> class << self irb(main):003:2> attr_reader :subclasses irb(main):004:2> def inherited(child) irb(main):005:3> subclasses << child irb(main):006:3> end irb(main):007:2> end irb(main):008:1> @subclasses = [] irb(main):009:1> end but anyway your version is cleaner... Jesus.