From: Pit Capitain Date: 2002-10-17T19:45:23+09:00 Subject: Re: Plugin autoregistration (inherited method call) Hi why, thanks for the code. Very nice idea. There's one error though: you don't store the Transport's subclass in the hash, but the class of the subclass, which is Class. So here's the modified version: class Transport @@transports = {} class << self def def_proto_id( pid ) @@transports[ pid ] = self end def registered_transports @@transports.keys end def create( pid ) @@transports[ pid ].new end end end class TCPTransport < Transport def_proto_id 'tcp' end class UDPTransport < Transport def_proto_id 'udp' end p( Transport.registered_transports.join(', ') ) # => "udp, tcp" p( Transport.create( 'tcp' ) ) # => # p( Transport.create( 'udp' ) ) # => # Regards, Pit