ruby/ruby — pull request #765 by jrafanie (2014-11-20 21:48:03+00:00)
Title: Support bare ipv6 hosts in URI::Generic.build 

URI::Generic.build accepts URI components and users may not expect that a host component needs to be wrapped with square brackets since it's not providing a URI.

#### Currently, we need to manually wrap ipv6 addess with brackets:
```ruby
URI::HTTP.build(:host => "[::1]", :path => "/bar/baz")
```

#### An alternative below is not good because URI should be abstracting this:
```ruby
uri = URI::HTTP.build(:path => "/bar/baz")
uri.hostname = server
uri
```

#### When passing a uri to URI to parse, then it makes sense to require []:
```ruby
URI("http://[::1]/bar/baz")
```

#### But, since I'm building from uri components, I would prefer to support either:

```ruby
URI::HTTP.build(:host => "[::1]", :path => "/bar/baz")
# Or
URI::HTTP.build(:host => "::1", :path => "/bar/baz")
```

**Note**
* I added missing assertions to the existing build tests in the first commit.
* I did not modify the `self.set_host(host)` line in the else case, when arg_check is false since ipv6 check seems similar to the existing host checks.