Class: VagrantPlugins::ProxyConf::UserinfoURI
- Inherits:
-
Object
- Object
- VagrantPlugins::ProxyConf::UserinfoURI
- Extended by:
- Forwardable
- Defined in:
- lib/vagrant-proxyconf/userinfo_uri.rb
Overview
Helper class that strips userinfo from the URI to separate attributes
Instance Attribute Summary collapse
-
#host ⇒ String
readonly
The host.
-
#pass ⇒ String
readonly
The password.
-
#port ⇒ String
readonly
The port.
-
#user ⇒ String
readonly
The username.
Instance Method Summary collapse
-
#initialize(uri) ⇒ UserinfoURI
constructor
A new instance of UserinfoURI.
-
#uri ⇒ String
(also: #to_s)
The URI without userinfo.
Constructor Details
#initialize(uri) ⇒ UserinfoURI
Returns a new instance of UserinfoURI.
23 24 25 26 |
# File 'lib/vagrant-proxyconf/userinfo_uri.rb', line 23 def initialize(uri) @set = !!uri @uri = URI.parse(uri || '') end |
Instance Attribute Details
#host ⇒ String (readonly)
Returns the host.
16 |
# File 'lib/vagrant-proxyconf/userinfo_uri.rb', line 16 def_delegators :@uri, :host, :port, :user |
#pass ⇒ String (readonly)
Returns the password.
20 |
# File 'lib/vagrant-proxyconf/userinfo_uri.rb', line 20 def_delegator :@uri, :password, :pass |
#port ⇒ String (readonly)
Returns the port.
16 |
# File 'lib/vagrant-proxyconf/userinfo_uri.rb', line 16 def_delegators :@uri, :host, :port, :user |
#user ⇒ String (readonly)
Returns the username.
16 |
# File 'lib/vagrant-proxyconf/userinfo_uri.rb', line 16 def_delegators :@uri, :host, :port, :user |
Instance Method Details
#uri ⇒ String Also known as: to_s
Returns the URI without userinfo.
29 30 31 32 33 34 35 36 37 |
# File 'lib/vagrant-proxyconf/userinfo_uri.rb', line 29 def uri if !@set nil elsif @uri.to_s.empty? "" else "#{@uri.scheme}://#{host}:#{port}" end end |