Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

URI::Generic#scheme=

scheme=(v)

Args

v

String

Description

Public setter for the scheme component v (with validation).

See also URI::Generic.check_scheme.

Usage

Example
require 'uri'

uri = URI.parse("http://my.example.com")
uri.scheme = "https"
uri.to_s  #=> "https://my.example.com"
See also #route_to #select #route_from #set_host also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1