Method: Bundler::URI::Generic#coerce

Defined in:
lib/bundler/vendor/uri/lib/uri/generic.rb

#coerce(oth) ⇒ Object

Args

v

Bundler::URI or String

Description

Attempts to parse other Bundler::URI oth, returns [parsed_oth, self].

Usage

require 'bundler/vendor/uri/lib/uri'

uri = Bundler::URI.parse("http://my.example.com")
uri.coerce("http://foo.com")
#=> [#<Bundler::URI::HTTP http://foo.com>, #<Bundler::URI::HTTP http://my.example.com>]


1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
# File 'lib/bundler/vendor/uri/lib/uri/generic.rb', line 1464

def coerce(oth)
  case oth
  when String
    oth = parser.parse(oth)
  else
    super
  end

  return oth, self
end