Build HTTP And HTTPS URLs
> URI::HTTP.build(host: 'example.com', port: 3000)
=> #<URI::HTTP http://example.com:3000>
> URI::HTTP.build(host: 'example.com', port: 3000, protocol: 'https')
=> #<URI::HTTP http://example.com:3000>> URI::HTTPS.build(host: 'example.com', port: 3000)
=> #<URI::HTTPS https://example.com:3000>> URI::HTTPS.build(host: 'example.com', port: 3000).to_s
=> "https://example.com:3000"> URI::HTTP.build(host: 'example.com', port: 3000, path: '/taco/bell')
=> #<URI::HTTP http://example.com:3000/taco/bell>
> URI::HTTP.build(host: 'example.com', port: 3000, path: 'taco/bell')
URI::InvalidComponentError: bad component(expected absolute path component): taco/bell
from /Users/jbranchaud/.asdf/installs/ruby/2.6.6/lib/ruby/2.6.0/uri/generic.rb:761:in `check_path'Last updated