instance method
URI::Generic#port=
((::String | ::Integer)? v) -> (::String | ::Integer)?
port=(v)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/uri/generic.rb, line 743
def port=(v)
check_port(v)
set_port(v)
set_userinfo(nil)
port
end
Args
v
Description
Public setter for the port component v (with validation).
See also URI::Generic.check_port.
Usage
Example
require 'uri' uri = URI.parse("http://my.example.com") uri.port = 8080 uri.to_s #=> "http://my.example.com:8080"