Extract Domain from URL

Ruby

Write a function called domain_name that when given a URL as a string, parses out just the domain name and returns it as a string.

For example:

domain_name("http://github.com/carbonfive/raygun") == "github" 
domain_name("http://www.zombie-bites.com") == "zombie-bites"
domain_name("https://www.cnet.com") == "cnet"
def domain_name(url) end
< >