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
10 def self.from_uri(uri)
11   self.new(uri.scheme, uri.host, uri.port)
12 end
new(scheme, host, port) click to toggle source
   # File lib/puppet/http/site.rb
14 def initialize(scheme, host, port)
15   @scheme = scheme
16   @host = host
17   @port = port.to_i
18 end

Public Instance Methods

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