From: "ara.t.howard" Date: 2007-11-08T09:16:22+09:00 Subject: Re: alternate to case; generating a list of sub-classes On Nov 7, 2007, at 4:57 PM, Thufir wrote: > The below uses pseudo-random number generation to populate an array > with various monsters, all inherit from Creature. Can a list of > classes which inherit from Creature be generated automagically? There > must be a better technique to fill the array then the case > statement... > cfp: ~> cat a.rb class Creature Children = [] def self.inherited other super ensure Children << other end end Creature::List.sort_by{ rand } a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama