class Qpid::Proton::URL
@deprecated use {URI} or {String}
Attributes
host[R]
password[R]
path[R]
scheme[R]
user[R]
username[R]
Public Class Methods
new(url = nil)
click to toggle source
Parse a string, return a new URL
@param url [#to_s] the URL
string
# 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
Public Instance Methods
port()
click to toggle source
# File lib/core/url.rb, line 61 def port Cproton.pn_url_get_port(@url).to_i end
port=(port)
click to toggle source
# 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()
click to toggle source
@return [String] Convert to string
# File lib/core/url.rb, line 66 def to_s "#{@scheme}://#{@username.nil? ? '' : @username}#{@password.nil? ? '' : '@' + @password + ':'}#{@host}:#{@port}/#{@path}" end
Also aliased as: to_str
Private Instance Methods
defaults()
click to toggle source
# File lib/core/url.rb, line 75 def defaults @scheme = @scheme || "amqp" @host = @host || "0.0.0.0" @port = @port || 5672 end