class HTTPClient::Site
Represents a Site: protocol scheme, host String and port Number.
Constants
- EMPTY
Attributes
Host String.
Port number.
Protocol scheme.
Public Class Methods
Source
# File lib/httpclient/session.rb, line 45 def initialize(uri = nil) if uri @scheme = uri.scheme || 'tcp' @host = uri.hostname || '0.0.0.0' @port = uri.port.to_i else @scheme = 'tcp' @host = '0.0.0.0' @port = 0 end end
Public Instance Methods
Source
# File lib/httpclient/session.rb, line 63 def ==(rhs) (@scheme == rhs.scheme) and (@host == rhs.host) and (@port == rhs.port) end
Returns true is scheme, host and port are ‘==’
Source
# File lib/httpclient/session.rb, line 58 def addr "#{@scheme}://#{@host}:#{@port.to_s}" end
Returns address String.
Source
# File lib/httpclient/session.rb, line 68 def eql?(rhs) self == rhs end
Same as ==.
Source
# File lib/httpclient/session.rb, line 81 def match(uri) (@scheme == uri.scheme) and (@host == uri.host) and (@port == uri.port.to_i) end
Returns true if scheme, host and port of the given URI matches with this.