Class: URI::HTTP

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

Constant Summary collapse

REGEX =
/([^:]+):\/\/([^\/])\/([^?]*)\??(.*)/

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ HTTP

Returns a new instance of HTTP.



7
8
9
10
11
12
13
14
15
# File 'lib/uri.rb', line 7

def initialize(url)
  @url = url
  uri_match = url.match(REGEX).to_a
  @scheme = uri_match[1]
  @host = uri_match[2]
  @path = uri_match[3]
  @query = uri_match[4]
  # TODO fragment
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/uri.rb', line 17

def to_s
  url
end