Created
July 21, 2011 18:43
-
-
Save s7ephen/1097875 to your computer and use it in GitHub Desktop.
inet_aton inet_ntoa in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> VERSION | |
=> "1.8.7" | |
>> require 'ipaddr' | |
=> true | |
>> IPAddr.new("10.0.0.1").to_i | |
=> 167772161 | |
>> IPAddr.new(167772161, Socket::AF_INET).to_s | |
=> "10.0.0.1" | |
>> # To look around to find this, its just a matter of: | |
>> IPAddr.new("10.0.0.1").methods | |
=> ["inspect", "to_range", "<<", ......... | |
.............. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment