Created
September 8, 2008 04:47
-
-
Save moro/9375 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# | |
# get current IP addr. | |
# reject internal netwok(eg. vmnet0, for VMware) at the end of method chain. | |
# is there better way? | |
# | |
Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF_INET). | |
map{|e| e[2] }. | |
uniq. | |
reject{|addr| addr =~ /\.1\Z/ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment