Guest User

Untitled

a guest
Feb 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. require 'resolv'
  2.  
  3. def ips_for(host)
  4. Resolv::DNS.open do |dns|
  5. ress = dns.getresources(host, Resolv::DNS::Resource::IN::A)
  6. ress.map { |r| r.address.to_s }
  7. end
  8. end
  9.  
  10. puts ips_for('heroku.com').sort.first
Add Comment
Please, Sign In to add comment