Method: URI::HTTP.build

Defined in:
lib/extensions/uri/uri/http.rb

.build(args) ⇒ Object

Description

Create a new URI::HTTP object from components, with syntax checking.

The components accepted are userinfo, host, port, path, query and fragment.

The components should be provided either as an Array, or as a Hash with keys formed by preceding the component names with a colon.

If an Array is used, the components must be passed in the order [userinfo, host, port, path, query, fragment].

Example:

newuri = URI::HTTP.build({:host => 'www.example.com', 
  :path> => '/foo/bar'})

newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path", 
  "query", 'fragment'])

Currently, if passed userinfo components this method generates invalid HTTP URIs as per RFC 1738.



57
58
59
60
# File 'lib/extensions/uri/uri/http.rb', line 57

def self.build(args)
  tmp = Util::make_components_hash(self, args)
  return super(tmp)
end