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 an URI object.



670
671
672
673
674
675
676
677
678
679
# File 'lib/uri/common.rb', line 670

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