このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 3.0 リファレンスマニュアル

instance method URI::Generic#to_s

to_s -> String[permalink][rdoc][edit]

自身が表す URI を文字列として返します。

例
require 'uri'
p URI('http://example.com/').to_s # => "http://example.com/"