class Puppet::HTTP::Site

Represents a site to which HTTP connections are made. It is a value object, and is suitable for use in a hash. If two sites are equal, then a persistent connection made to the first site, can be re-used for the second.

@api private

Attributes

host[R]
port[R]
scheme[R]

Public Class Methods

from_uri(uri) click to toggle source
   # File lib/puppet/http/site.rb
11 def self.from_uri(uri)
12   self.new(uri.scheme, uri.host, uri.port)
13 end
new(scheme, host, port) click to toggle source
   # File lib/puppet/http/site.rb
15 def initialize(scheme, host, port)
16   @scheme = scheme
17   @host = host
18   @port = port.to_i
19 end

Public Instance Methods

==(rhs) click to toggle source
   # File lib/puppet/http/site.rb
26 def ==(rhs)
27   (@scheme == rhs.scheme) && (@host == rhs.host) && (@port == rhs.port)
28 end
Also aliased as: eql?
addr() click to toggle source
   # File lib/puppet/http/site.rb
21 def addr
22   "#{@scheme}://#{@host}:#{@port}"
23 end
Also aliased as: to_s
eql?(rhs)
Alias for: ==
hash() click to toggle source
   # File lib/puppet/http/site.rb
32 def hash
33   [@scheme, @host, @port].hash
34 end
move_to(uri) click to toggle source
   # File lib/puppet/http/site.rb
40 def move_to(uri)
41   self.class.new(uri.scheme, uri.host, uri.port)
42 end
to_s()
Alias for: addr
use_ssl?() click to toggle source
   # File lib/puppet/http/site.rb
36 def use_ssl?
37   @scheme == 'https'
38 end