Module: Kernel

Defined in:
lib/uri/common.rb

Overview

module URI

Class Method Summary collapse

Class Method Details

.URI(uri) ⇒ Object

Returns uri converted to a URI object.



709
710
711
712
713
714
715
716
717
718
# File 'lib/uri/common.rb', line 709

def URI(uri)
  if uri.is_a?(URI::Generic)
    uri
  elsif uri = String.try_convert(uri)
    URI.parse(uri)
  else
    raise ArgumentError,
      "bad argument (expected URI object or URI string)"
  end
end