Class: Gem::Request::ConnectionPools
- Inherits:
-
Object
- Object
- Gem::Request::ConnectionPools
- Defined in:
- lib/rubygems/request/connection_pools.rb
Overview
:nodoc:
Class Attribute Summary collapse
-
.client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #close_all ⇒ Object
-
#initialize(proxy_uri, cert_files) ⇒ ConnectionPools
constructor
A new instance of ConnectionPools.
- #pool_for(uri) ⇒ Object
Constructor Details
#initialize(proxy_uri, cert_files) ⇒ ConnectionPools
Returns a new instance of ConnectionPools.
10 11 12 13 14 15 |
# File 'lib/rubygems/request/connection_pools.rb', line 10 def initialize(proxy_uri, cert_files) @proxy_uri = proxy_uri @cert_files = cert_files @pools = {} @pool_mutex = Mutex.new end |
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/rubygems/request/connection_pools.rb', line 7 def client @client end |
Instance Method Details
#close_all ⇒ Object
30 31 32 |
# File 'lib/rubygems/request/connection_pools.rb', line 30 def close_all @pools.each_value {|pool| pool.close_all } end |
#pool_for(uri) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubygems/request/connection_pools.rb', line 17 def pool_for(uri) http_args = net_http_args(uri, @proxy_uri) key = http_args + [https?(uri)] @pool_mutex.synchronize do @pools[key] ||= if https? uri Gem::Request::HTTPSPool.new(http_args, @cert_files, @proxy_uri) else Gem::Request::HTTPPool.new(http_args, @cert_files, @proxy_uri) end end end |