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

instance method URI::Generic#to_s

to_s -> String[permalink][rdoc][edit]
to_str -> StringRuby 3.3 から

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

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