You can execute the nslookup command as follows:
`nslookup #{domain}`
and analyze the results as regular expression text, etc.
Or you can use the Socket class, in particular Socket.getaddrinfo. See StackOverflow 's previous answer on this very question.
source share