Method: Gem::URI.parse

Defined in:
lib/rubygems/vendor/uri/lib/uri/common.rb

.parse(uri) ⇒ Object

Returns a new Gem::URI object constructed from the given string uri:

Gem::URI.parse('https://[email protected]:123/forum/questions/?tag=networking&order=newest#top')
# => #<Gem::URI::HTTPS https://[email protected]:123/forum/questions/?tag=networking&order=newest#top>
Gem::URI.parse('http://[email protected]:123/forum/questions/?tag=networking&order=newest#top')
# => #<Gem::URI::HTTP http://[email protected]:123/forum/questions/?tag=networking&order=newest#top>

It’s recommended to first ::escape string uri if it may contain invalid Gem::URI characters.



207
208
209
# File 'lib/rubygems/vendor/uri/lib/uri/common.rb', line 207

def self.parse(uri)
  DEFAULT_PARSER.parse(uri)
end