class URI::HTTP
Attributes
fragment[RW]
host[RW]
hostname[RW]
password[RW]
path[RW]
port[W]
query[RW]
scheme[RW]
user[RW]
Public Class Methods
new(str)
click to toggle source
# File lib/hub/speedy_stdlib.rb, line 62 def initialize(str) m = str.to_s.match(%r{^ ([\w-]+): // (?:([^/@]+)@)? ([^/?#]+) }x) 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
Public Instance Methods
find_proxy()
click to toggle source
# File lib/hub/speedy_stdlib.rb, line 103 def find_proxy end
port()
click to toggle source
# File lib/hub/speedy_stdlib.rb, line 88 def port (@port || (scheme == 'https' ? 443 : 80)).to_i end
request_uri()
click to toggle source
# File lib/hub/speedy_stdlib.rb, line 82 def request_uri url = path url += "?#{query}" if query url end
to_s()
click to toggle source
# 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
userinfo()
click to toggle source
# File lib/hub/speedy_stdlib.rb, line 97 def userinfo if password then "#{user}:#{password}" elsif user then user end end
userinfo=(info)
click to toggle source
# File lib/hub/speedy_stdlib.rb, line 92 def userinfo=(info) self.user, self.password = info.to_s.split(':', 2) info end