Method: EVURI#initialize

Defined in:
lib/rwd/net.rb

#initialize(url) ⇒ EVURI



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/rwd/net.rb', line 145

def initialize(url)
  begin
    @protocol, @userpass, @host, @port, d1, @path, d2, @vars, @anchor = URI.split(url.to_s)
  rescue
  end

  @path   = "/"    if (not @path.nil? and @path.empty? and @protocol == "http")

  @protocol   = ""   if @protocol.nil?
  @userpass   = ""   if @userpass.nil?
  @host   = ""   if @host.nil?
  @port   = 0    if @port.nil?
  @path   = ""   if @path.nil?
  @vars   = ""   if @vars.nil?
  @anchor   = ""   if @anchor.nil?

  res     = {}
  @varsvolgorde = []
  @vars.split(/&/).each{|var| k, v = var.split(/=/) ; res[k] = v ; @varsvolgorde << k}
  @vars   = res

  @port   = @port.to_i
end