Skip to content

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

instance method

URI::Generic#query=

(::String? v) -> ::String?
query=(v)

Args

v

String

Description

Public setter for the query component v.

Usage

Example
require 'uri'

uri = URI.parse("http://my.example.com/?id=25")
uri.query = "id=1"
uri.to_s  #=> "http://my.example.com/?id=1"
See also #port= #registry= #path= #relative? also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0