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.
12 13 14 15 16 17 |
# File 'lib/rubygems/request/connection_pools.rb', line 12 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.
9 10 11 |
# File 'lib/rubygems/request/connection_pools.rb', line 9 def client @client end |
Instance Method Details
#close_all ⇒ Object
32 33 34 |
# File 'lib/rubygems/request/connection_pools.rb', line 32 def close_all @pools.each_value {|pool| pool.close_all} end |
#pool_for(uri) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubygems/request/connection_pools.rb', line 19 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 then Gem::Request::HTTPSPool.new(http_args, @cert_files, @proxy_uri) else Gem::Request::HTTPPool.new(http_args, @cert_files, @proxy_uri) end end end |