0
有沒有一種可能的方式來獲取域的主機名在ruby中?在ruby中獲取域名主機名
例如:
$ host api.heroku.com
api.heroku.com is an alias for api-default.herokussl.com.
api-default.herokussl.com is an alias for elb027033-298234319.us-east-1.elb.amazonaws.com.
elb027033-298234319.us-east-1.elb.amazonaws.com has address 23.23.76.65
elb027033-298234319.us-east-1.elb.amazonaws.com has address 23.21.240.208
elb027033-298234319.us-east-1.elb.amazonaws.com has address 107.22.242.236
主機將是最好的例子,因爲它也將展示如果域/子域指向或另一臺主機像amazonAWS等
['Resolv'](http://ruby-doc.org/stdlib-1.9.2/libdoc/resolv/rdoc/Resolv.html) - 該文檔甚至有一些很好的例子。 – Amadan
哪些文檔?我使用Resolv嘗試了一些東西,但沒有像從ruby執行'host domain.com'命令那樣有用。 – user3610137