Skip to content

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

instance method

URI::Generic#query=

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.4 · 3.3 · 3.1 · 3.0