Hi gurus and nubys,

The problem I'm facing is:
I wanto to use a subclass of TCPSocket. 
Everything works fine while I'm using it to connect outside.

But now I'd like to use a MySocket even when I'm receiving
connections.
BTW, TCPServer.accept just gives me a classic vanilla TCPSocket.

now I have 3 way to go: 
-add methods to TCPSocket instead of subclass it
-add a MyServer class as a subclass of TCPServer
-wriap up a TCPSocket in a MySocket class instead of subclassing it.

My point is: this ways are ugly to me. 

So, is there a way in ruby  to get a subclass instance from a
superclass instance?

I know that often this could be impossible, but who knows ;)

something like:
class MyKlass < Klass
...
end

MyKlass.get_instance_from(Klass.new)