Class: URI::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/hub/speedy_stdlib.rb

Direct Known Subclasses

Hub::Context::GithubURL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, *extra) ⇒ HTTP

Returns a new instance of HTTP.



76
77
78
79
80
81
82
83
84
# File 'lib/hub/speedy_stdlib.rb', line 76

def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, *extra)
  self.scheme = scheme
  self.userinfo = userinfo
  self.host = host
  self.port = port
  self.path = path
  self.query = query
  self.fragment = fragment
end

Instance Attribute Details

#fragmentObject

Returns the value of attribute fragment.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def fragment
  @fragment
end

#hostObject Also known as: hostname

Returns the value of attribute host.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def host
  @host
end

#passwordObject

Returns the value of attribute password.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def password
  @password
end

#pathObject

Returns the value of attribute path.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def path
  @path
end

#portObject

Returns the value of attribute port.



73
74
75
# File 'lib/hub/speedy_stdlib.rb', line 73

def port
  @port
end

#queryObject

Returns the value of attribute query.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def query
  @query
end

#schemeObject

Returns the value of attribute scheme.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def scheme
  @scheme
end

#userObject

Returns the value of attribute user.



72
73
74
# File 'lib/hub/speedy_stdlib.rb', line 72

def user
  @user
end

Instance Method Details

#find_proxyObject



121
122
# File 'lib/hub/speedy_stdlib.rb', line 121

def find_proxy
end

#request_uriObject



96
97
98
99
100
# File 'lib/hub/speedy_stdlib.rb', line 96

def request_uri
  url = path
  url += "?#{query}" if query
  url
end

#to_sObject



86
87
88
89
90
91
92
93
94
# File 'lib/hub/speedy_stdlib.rb', line 86

def to_s
  url = "#{scheme}://"
  url << "#{userinfo}@" if user || password
  url << host << display_port
  url << path
  url << "?#{query}" if query
  url << "##{fragment}" if fragment
  url
end

#userinfoObject



115
116
117
118
119
# File 'lib/hub/speedy_stdlib.rb', line 115

def userinfo
  if password then "#{user}:#{password}"
  elsif user then user
  end
end

#userinfo=(info) ⇒ Object



110
111
112
113
# File 'lib/hub/speedy_stdlib.rb', line 110

def userinfo=(info)
  self.user, self.password = info.to_s.split(':', 2)
  info
end