On Saturday 25 January 2003 01:56 pm, Sam Roberts wrote: > Quoteing davegaramond / icqmail.com, on Mon, Jan 20, 2003 at 10:00:51PM +0900: > > i want to have a class that can support multiple sets of methods, based > > on what the client requests. so far i have written the following python > > code. it's ugly/not elegant and i haven't managed to come up with a less > > ugly ruby version :-) likewise untested: class C def C.factory(type) case type when :a return Ca else return Cb end end class Ca < self def foo puts 'override foo' end end class Cb < self def foo puts 'override foo' end end def foo puts 'default foo' end end c = C.factory(:a).new -- tom sawyer, aka transami transami / transami.net