| Class | URI::Generic |
| In: |
lib/uri/generic.rb
|
| Parent: | Object |
Base class for all URI classes.
| DEFAULT_PORT | = | nil |
| COMPONENT | = | [ :scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment |
| USE_REGISTRY | = | false |
| fragment | [R] | |
| host | [R] | |
| opaque | [R] | |
| path | [R] | |
| port | [R] | |
| query | [R] | |
| registry | [R] | |
| scheme | [R] |
See new
Creates a new URI::Generic instance from components of URI::Generic with check. Components are: scheme, userinfo, host, port, registry, path, opaque, query and fragment. You can provide arguments either by an Array or a Hash. See new for hash keys to use or for order of array items.
See new
At first, tries to create a new URI::Generic instance using URI::Generic::build. But, if exception URI::InvalidComponentError is raised, then it URI::Escape.escape all URI components and tries again.
| scheme: | Protocol scheme, i.e. ‘http’,’ftp’,’mailto’ and so on. |
| userinfo: | User name and password, i.e. ‘sdmitry:bla’ |
| host: | Server host name |
| port: | Server port |
| registry: | DOC: FIXME! |
| path: | Path on server |
| opaque: | DOC: FIXME! |
| query: | Query data |
| fragment: | A part of URI after ’#’ sign |
| arg_check: | Check arguments [false by default] |
Creates a new URI::Generic instance from ``generic’’ components without check.
| components: | Multiple Symbol arguments defined in URI::HTTP |
Selects specified components from URI
require 'uri'
uri = URI.parse('http://myuser:[email protected]/test.rbx')
p uri.select(:userinfo, :host, :path)
# => ["myuser:mypass", "my.example.com", "/test.rbx"]