<p>I'm looking for a method to reliably extract the host name from a URL string in Ruby.</p>

<p>e.g. 
<a href="http://www.mglenn.com/directory" rel="noreferrer">http://www.mglenn.com/directory</a> = www.mglenn.com
OR
<a href="http://www.mglenn.com?param=x" rel="noreferrer">http://www.mglenn.com?param=x</a> = www.mglenn.com</p>

You could try something like this:
```
```
require 'uri'

myUri = URI.parse( 'http://www.mglenn.com/directory' )
print myUri.host
# =>  www.mglenn.com
```
```