DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Convert An Integer To IP String

04.04.2008
| 12387 views |
  • submit to reddit
        Convert an integer to IP. I don't think you can do this with IPAddr, but I could be wrong

Edit, the original didn't work for low ranges.

And I was wrong about the IPAddr thing. I should have google'd better.

IPAddr.new(16909060, Socket::AF_INET).to_s