Class: Puppet::HTTP::Site Private
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
- #host ⇒ Object readonly private
- #port ⇒ Object readonly private
- #scheme ⇒ Object readonly private
Class Method Summary collapse
- .from_uri(uri) ⇒ Object private
Instance Method Summary collapse
- #==(rhs) ⇒ Object (also: #eql?) private
- #addr ⇒ Object (also: #to_s) private
- #hash ⇒ Object private
-
#initialize(scheme, host, port) ⇒ Site
constructor
private
A new instance of Site.
- #move_to(uri) ⇒ Object private
- #use_ssl? ⇒ Boolean private
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.
14 15 16 17 18 |
# File 'lib/puppet/http/site.rb', line 14 def initialize(scheme, host, port) @scheme = scheme @host = host @port = port.to_i end |
Instance Attribute Details
#host ⇒ Object (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.
8 9 10 |
# File 'lib/puppet/http/site.rb', line 8 def host @host end |
#port ⇒ Object (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.
8 9 10 |
# File 'lib/puppet/http/site.rb', line 8 def port @port end |
#scheme ⇒ Object (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.
8 9 10 |
# File 'lib/puppet/http/site.rb', line 8 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.
10 11 12 |
# File 'lib/puppet/http/site.rb', line 10 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.
25 26 27 |
# File 'lib/puppet/http/site.rb', line 25 def ==(rhs) (@scheme == rhs.scheme) && (@host == rhs.host) && (@port == rhs.port) end |
#addr ⇒ Object 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.
20 21 22 |
# File 'lib/puppet/http/site.rb', line 20 def addr "#{@scheme}://#{@host}:#{@port}" end |
#hash ⇒ 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.
31 32 33 |
# File 'lib/puppet/http/site.rb', line 31 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.
39 40 41 |
# File 'lib/puppet/http/site.rb', line 39 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.
35 36 37 |
# File 'lib/puppet/http/site.rb', line 35 def use_ssl? @scheme == 'https' end |