instance method
URI::Generic#coerce
(::URI::Generic | ::String oth) -> ::Array[::URI::Generic]
coerce(oth)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/uri/generic.rb, line 1478
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 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0