def host=(new_host)
if new_host && !new_host.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_host.class} into String."
end
@host = new_host ? new_host.to_str : nil
unreserved = CharacterClasses::UNRESERVED
sub_delims = CharacterClasses::SUB_DELIMS
if @host != nil && (@host =~ /[<>{}\/\?\#\@]/ ||
(@host[/^\[(.*)\]$/, 1] != nil && @host[/^\[(.*)\]$/, 1] !~
Regexp.new("^[#{unreserved}#{sub_delims}:]*$")))
raise InvalidURIError, "Invalid character in host: '#{@host.to_s}'"
end
@authority = nil
@normalized_host = nil
@uri_string = nil
@hash = nil
validate()
end