Class: Qpid::Proton::URL
Deprecated
Overview
Constant Summary
Qpid::Proton::Util::Deprecation::DEPRECATE_FULL_TRACE, Qpid::Proton::Util::Deprecation::MATCH_DIR
Instance Attribute Summary collapse
Instance Method Summary
collapse
deprecated, #deprecated, included
Constructor Details
#initialize(url = nil) ⇒ URL
Parse a string, return a new URL
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/core/url.rb', line 34
def initialize(url = nil)
deprecated self.class, 'URI or String'
if url
@url = Cproton.pn_url_parse(url.to_s)
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
29
30
31
|
# File 'lib/core/url.rb', line 29
def host
@host
end
|
#password ⇒ Object
28
29
30
|
# File 'lib/core/url.rb', line 28
def password
@password
end
|
#path ⇒ Object
30
31
32
|
# File 'lib/core/url.rb', line 30
def path
@path
end
|
#scheme ⇒ Object
25
26
27
|
# File 'lib/core/url.rb', line 25
def scheme
@scheme
end
|
#username ⇒ Object
Also known as:
user
26
27
28
|
# File 'lib/core/url.rb', line 26
def username
@username
end
|
Instance Method Details
#port ⇒ Object
61
62
63
|
# File 'lib/core/url.rb', line 61
def port
Cproton.pn_url_get_port(@url).to_i
end
|
#port=(port) ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/core/url.rb', line 53
def port=(port)
if port.nil?
Cproton.pn_url_set_port(@url, nil)
else
Cproton.pn_url_set_port(@url, port)
end
end
|
#to_s ⇒ String
Also known as:
to_str
Returns Convert to string.
66
67
68
|
# File 'lib/core/url.rb', line 66
def to_s
"#{@scheme}://#{@username.nil? ? '' : @username}#{@password.nil? ? '' : '@' + @password + ':'}#{@host}:#{@port}/#{@path}"
end
|