Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
Created October 10, 2008 01:55
Show Gist options
  • Save adamwiggins/15961 to your computer and use it in GitHub Desktop.
Save adamwiggins/15961 to your computer and use it in GitHub Desktop.
require 'resolv'
def ips_for(host)
Resolv::DNS.open do |dns|
ress = dns.getresources(host, Resolv::DNS::Resource::IN::A)
ress.map { |r| r.address.to_s }
end
end
puts ips_for('heroku.com').sort.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment