Skip to content

Instantly share code, notes, and snippets.

@berga
Forked from qsun/gist:1247402
Created April 5, 2019 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berga/6683bb2c3c36531a2762f963ad882eaa to your computer and use it in GitHub Desktop.
Save berga/6683bb2c3c36531a2762f963ad882eaa to your computer and use it in GitHub Desktop.
ruby integer to/from ip address
require 'ipaddr'
IPAddr.new('1.2.3.4').to_i
IPAddr.new(16909060, Socket::AF_INET).to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment