Skip to content
instance method

URI::Generic#port=

((::String | ::Integer)? v) -> (::String | ::Integer)?
port=(v)

Args

v

String

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"
See also #path= #query= #password= #relative? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0