Parent

Files

HTTPClient::Site

Represents a Site: protocol scheme, host String and port Number.

Attributes

scheme[RW]

Protocol scheme.

host[R]

Host String.

port[R]

Port number.

Public Class Methods

new(uri = nil) click to toggle source

Creates a new Site based on the given URI.

    # File lib/httpclient/session.rb, line 35
35:     def initialize(uri = nil)
36:       if uri
37:         @scheme = uri.scheme
38:         @host = uri.host
39:         @port = uri.port.to_i
40:       else
41:         @scheme = 'tcp'
42:         @host = '0.0.0.0'
43:         @port = 0
44:       end
45:     end

Public Instance Methods

==(rhs) click to toggle source

Returns true is scheme, host and port are ’==’

    # File lib/httpclient/session.rb, line 53
53:     def ==(rhs)
54:       (@scheme == rhs.scheme) and (@host == rhs.host) and (@port == rhs.port)
55:     end
addr() click to toggle source

Returns address String.

    # File lib/httpclient/session.rb, line 48
48:     def addr
49:       "#{@scheme}://#{@host}:#{@port.to_s}"
50:     end
eql?(rhs) click to toggle source

Same as ==.

    # File lib/httpclient/session.rb, line 58
58:     def eql?(rhs)
59:       self == rhs
60:     end
match(uri) click to toggle source

Returns true if scheme, host and port of the given URI matches with this.

    # File lib/httpclient/session.rb, line 71
71:     def match(uri)
72:       (@scheme == uri.scheme) and (@host == uri.host) and (@port == uri.port.to_i)
73:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.