Skip to content

Instantly share code, notes, and snippets.

@Lax
Created January 13, 2014 08:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Lax/8396532 to your computer and use it in GitHub Desktop.
Save Lax/8396532 to your computer and use it in GitHub Desktop.
Ruby IPAddr class, inet_aton and inet_ntoa equivalence.
require 'ipaddr'
IPAddr.new("192.168.0.1").to_i
=> 3232235521
IPAddr.new(3232235521, Socket::AF_INET).to_s
=> "192.168.0.1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment