Home » Ruby-3.3.6 » bundler » Index (C) » Gem » Net » HTTP » Persistent » Connection ▲
123456789_123456789_123456789_123456789_123456789_

Class: Gem::Net::HTTP::Persistent::Connection

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb

Overview

A Gem::Net::HTTP connection wrapper that holds extra information for managing the connection’s lifetime.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(http_class, http_args, ssl_generation) ⇒ Connection

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 15

def initialize http_class, http_args, ssl_generation
  @http           = http_class.new(*http_args)
  @ssl_generation = ssl_generation

  reset
end

Instance Attribute Details

#http (rw)

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 7

attr_accessor :http

#last_use (rw)

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 9

attr_accessor :last_use

#requests (rw)

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 11

attr_accessor :requests

#ssl_generation (rw)

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 13

attr_accessor :ssl_generation

Instance Method Details

#close

Alias for #finish.

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 28

alias_method :close, :finish

#finish Also known as: #close

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 22

def finish
  @http.finish
rescue IOError
ensure
  reset
end

#reset

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 30

def reset
  @last_use = Gem::Net::HTTP::Persistent::EPOCH
  @requests = 0
end

#ressl(ssl_generation)

[ GitHub ]

  
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb', line 35

def ressl ssl_generation
  @ssl_generation = ssl_generation

  finish
end