you've just deployed your newest ruby app on a bunch of servers, and you need that this app knows the IP address of the server where it's running.
I've read some bizarre ways ("Get your local IP address" or "Get your local IP address") to do this, such as opening an UDP socket and inferring it from the interface used to route the packet.
With the Socket class you may do this more easily and also get the benefit of having useful Addrinfo objects and you are able to distinguish easily between public and private interfaces.
First of all:
You can then filter them using the standard Enumerable methods select() and detect() along with these Addrinfo methods: