Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
URI::Generic#host=
(::String? v) -> ::String?
host=(v)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/uri/generic.rb, line 639
def host=(v)
check_host(v)
set_host(v)
v
end
Args
v
Description
Public setter for the host component v (with validation).
See also URI::Generic.check_host.
Usage
Example
require 'uri' uri = URI.parse("http://my.example.com") uri.host = "foo.com" uri.to_s #=> "http://foo.com"