Sha256: ba5a89e70ea5cc826be645837ea19aa8346804a5413e60eb9bc705b1c525b484

Contents?: true

Size: 787 Bytes

Versions: 465

Compression:

Stored size: 787 Bytes

Contents

# 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
#
class Puppet::Network::HTTP::Site
  attr_reader :scheme, :host, :port

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

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

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

  alias eql? ==

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

  def use_ssl?
    @scheme == 'https'
  end

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

Version data entries

465 entries across 465 versions & 3 rubygems

Version Path
puppet-5.5.13-x64-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.13-universal-darwin lib/puppet/network/http/site.rb
puppet-6.4.0 lib/puppet/network/http/site.rb
puppet-6.4.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.4.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.4.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.0.7 lib/puppet/network/http/site.rb
puppet-6.0.7-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.0.7-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.0.7-universal-darwin lib/puppet/network/http/site.rb
puppet-5.5.12 lib/puppet/network/http/site.rb
puppet-5.5.12-x86-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.12-x64-mingw32 lib/puppet/network/http/site.rb
puppet-5.5.12-universal-darwin lib/puppet/network/http/site.rb
puppet-6.3.0 lib/puppet/network/http/site.rb
puppet-6.3.0-x86-mingw32 lib/puppet/network/http/site.rb
puppet-6.3.0-x64-mingw32 lib/puppet/network/http/site.rb
puppet-6.3.0-universal-darwin lib/puppet/network/http/site.rb
puppet-6.2.0 lib/puppet/network/http/site.rb
puppet-6.2.0-x86-mingw32 lib/puppet/network/http/site.rb