Class: Qpid::Proton::URL
- Inherits:
-
Object
- Object
- Qpid::Proton::URL
- Defined in:
- lib/core/url.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(url = nil, options = {}) ⇒ URL
constructor
A new instance of URL.
- #to_s ⇒ Object
Constructor Details
#initialize(url = nil, options = {}) ⇒ URL
Returns a new instance of URL.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/core/url.rb', line 31 def initialize(url = nil, = {}) [:defaults] = true if url @url = Cproton.pn_url_parse(url) if @url.nil? raise ::ArgumentError.new("invalid url: #{url}") end else @url = Cproton.pn_url end @scheme = Cproton.pn_url_get_scheme(@url) @username = Cproton.pn_url_get_username(@url) @password = Cproton.pn_url_get_password(@url) @host = Cproton.pn_url_get_host(@url) @port = Cproton.pn_url_get_port(@url) @path = Cproton.pn_url_get_path(@url) defaults end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
27 28 29 |
# File 'lib/core/url.rb', line 27 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
26 27 28 |
# File 'lib/core/url.rb', line 26 def password @password end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
29 30 31 |
# File 'lib/core/url.rb', line 29 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
28 29 30 |
# File 'lib/core/url.rb', line 28 def port @port end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
24 25 26 |
# File 'lib/core/url.rb', line 24 def scheme @scheme end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
25 26 27 |
# File 'lib/core/url.rb', line 25 def username @username end |
Instance Method Details
#to_s ⇒ Object
63 64 65 |
# File 'lib/core/url.rb', line 63 def to_s "#{@scheme}://#{@username.nil? ? '' : @username}#{@password.nil? ? '' : '@' + @password + ':'}#{@host}:#{@port}/#{@path}" end |