Class: Puppet::Network::HTTP::Site Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/network/http/site.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme, host, port) ⇒ Site

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Site


15
16
17
18
19
# File 'lib/puppet/network/http/site.rb', line 15

def initialize(scheme, host, port)
  @scheme = scheme
  @host = host
  @port = port.to_i
end

Instance Attribute Details

#hostObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


9
10
11
# File 'lib/puppet/network/http/site.rb', line 9

def host
  @host
end

#portObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


9
10
11
# File 'lib/puppet/network/http/site.rb', line 9

def port
  @port
end

#schemeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


9
10
11
# File 'lib/puppet/network/http/site.rb', line 9

def scheme
  @scheme
end

Class Method Details

.from_uri(uri) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


11
12
13
# File 'lib/puppet/network/http/site.rb', line 11

def self.from_uri(uri)
  self.new(uri.scheme, uri.host, uri.port)
end

Instance Method Details

#==(rhs) ⇒ Object Also known as: eql?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


26
27
28
# File 'lib/puppet/network/http/site.rb', line 26

def ==(rhs)
  (@scheme == rhs.scheme) && (@host == rhs.host) && (@port == rhs.port)
end

#addrObject Also known as: to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


21
22
23
# File 'lib/puppet/network/http/site.rb', line 21

def addr
  "#{@scheme}://#{@host}:#{@port}"
end

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


32
33
34
# File 'lib/puppet/network/http/site.rb', line 32

def hash
  [@scheme, @host, @port].hash
end

#move_to(uri) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


40
41
42
# File 'lib/puppet/network/http/site.rb', line 40

def move_to(uri)
  self.class.new(uri.scheme, uri.host, uri.port)
end

#use_ssl?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


36
37
38
# File 'lib/puppet/network/http/site.rb', line 36

def use_ssl?
  @scheme == 'https'
end