Method: Qpid::Proton::URL#initialize

Defined in:
lib/core/url.rb

#initialize(url = nil) ⇒ URL

Parse a string, return a new URL

Parameters:

  • url (#to_s) (defaults to: nil)

    the URL string



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