Create a URL with URI::HTTP.build : URI « Network « Ruby






Create a URL with URI::HTTP.build


require 'uri'

URI::HTTP.build(:host => 'example.com', :path => '/file.html',
                :fragment => 'section_3').to_s
# => "http://example.com/a/file.html#section_3"

 








Related examples in the same category

1.Parsing URLs
2.Split a URL
3.URI::HTTP.component
4.URI::MailTo.component
5.Dump a URL
6.mailto URI parse
7.URI parse
8.Extracting All the URLs from an HTML Document
9.Get only http and https based url