From Delphi's Indy10 to Ruby

I come from Delphi programming and I have chosen Rubyi as the new
programming language that I would like to learn.

In Delphi XE8, I build an internet tools generally using the
TIdMappedPortTCP, a multithreaded component of Indy socket.
I usually use its OnExecute and OnOutboundData events to
modify data as it passes through the proxy.

Since I am totally new to Ruby programming, so I don’t know
how to start, or to be exact, to convert my Delphi code into
the Ruby code style.

So, I ventured to ask :

  1. What’re the components of Ruby ​​to be necessary and should
    be used so that the results can be the same as the my Indy/Delphi’s code
    ?.
  2. Is there examples of Ruby code that works like this Delphi code ? I
    've tried looking but can not find it.

For your info, the example of Delphi/Indy 10 code that I’m currently
using, you can view at here http://pastebin.com/bQJGiqSa

Please help! Thank you very much.

Cheers,
I

Fabian Schön wrote in post #1176381:

  1. What’re the components of Ruby ​​to be necessary and should
    be used so that the results can be the same as the my Indy/Delphi’s code

Event machine
cool.io

  1. Is there examples of Ruby code that works like this Delphi code ? I
    've tried looking but can not find it.

http://pleac.sourceforge.net/pleac_ruby/sockets.html

And, if you don’t worry about performances :