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.


688
689
690
691
692
693
694
695
696
697
# File 'lib/uri/common.rb', line 688

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