Skip to content

Instantly share code, notes, and snippets.

@a1ip
Created September 30, 2013 19:12
Show Gist options
  • Save a1ip/6768630 to your computer and use it in GitHub Desktop.
Save a1ip/6768630 to your computer and use it in GitHub Desktop.
# ruby version >= 2.1.0
require 'socket'
Socket.getifaddrs.each do |i|
puts "#{i.name}: #{i.addr.ip_address}" if i.addr.ip?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment