# File lib/hub/speedy_stdlib.rb, line 62 def initialize(str) m = str.to_s.match(%r{^ ([\w-]+): // (?:([^/@]+)@)? ([^/?#]+) }) raise InvalidURIError unless m _, self.scheme, self.userinfo, host = m.to_a self.host, self.port = host.split(':', 2) path, self.fragment = m.post_match.split('#', 2) self.path, self.query = path.to_s.split('?', 2) end
# File lib/hub/speedy_stdlib.rb, line 103 def find_proxy end
# File lib/hub/speedy_stdlib.rb, line 88 def port (@port || (scheme == 'https' ? 443 : 80)).to_i end
# File lib/hub/speedy_stdlib.rb, line 82 def request_uri url = path url += "?#{query}" if query url end
# File lib/hub/speedy_stdlib.rb, line 71 def to_s url = "#{scheme}://" url << "#{userinfo}@" if user || password url << host url << ":#{@port}" if @port url << path url << "?#{query}" if query url << "##{fragment}" if fragment url end
# File lib/hub/speedy_stdlib.rb, line 97 def userinfo if password then "#{user}:#{password}" elsif user then user end end
# File lib/hub/speedy_stdlib.rb, line 92 def userinfo=(info) self.user, self.password = info.to_s.split(':', 2) info end