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#coerce
coerce(oth)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/uri/generic.rb, line 1463
def coerce(oth)
case oth
when String
oth = parser.parse(oth)
else
super
end
return oth, self
end
Args
Description
Attempts to parse other URI oth, returns [parsed_oth, self].
Usage
Example
require 'uri' uri = URI.parse("http://my.example.com") uri.coerce("http://foo.com") #=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]
See also
#check_userinfo
#component
#check_user
#component_ary
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1