End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
URI::Generic#port=
port=(v)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/uri/generic.rb, line 719
def port=(v)
check_port(v)
set_port(v)
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"