module Gem
Public Class Methods
Returns a Gem::URI object derived from the given uri, which may be a Gem::URI string or an existing Gem::URI object:
require 'rubygems/vendor/uri/lib/uri' # Returns a new Gem::URI. uri = Gem::URI('http://github.com/ruby/ruby') # => #<Gem::URI::HTTP http://github.com/ruby/ruby> # Returns the given Gem::URI. Gem::URI(uri) # => #<Gem::URI::HTTP http://github.com/ruby/ruby>
You must require ‘rubygems/vendor/uri/lib/uri’ to use this method.
# File lib/rubygems/vendor/uri/lib/uri/common.rb, line 911 def URI(uri) if uri.is_a?(Gem::URI::Generic) uri elsif uri = String.try_convert(uri) Gem::URI.parse(uri) else raise ArgumentError, "bad argument (expected Gem::URI object or Gem::URI string)" end end