Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

URI::Generic#user=

user=(user)

Args

v

String

Description

Public setter for the user component (with validation).

See also URI::Generic.check_user.

Usage

Example
require 'uri'

uri = URI.parse("http://john:[email protected]")
uri.user = "sam"
uri.to_s  #=> "http://sam:[email protected]"
See also #user #userinfo #to_str #userinfo= also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0