Class: Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti
- Inherits:
-
ConnectionPool::TimedStack
- Object
- ConnectionPool::TimedStack
- Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti
- Defined in:
- lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from ConnectionPool::TimedStack
Class Method Summary collapse
-
.hash_of_arrays ⇒ Object
Returns a new hash that has arrays for keys.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(size = 0, &block) ⇒ TimedStackMulti
constructor
A new instance of TimedStackMulti.
- #length ⇒ Object
Methods inherited from ConnectionPool::TimedStack
Constructor Details
#initialize(size = 0, &block) ⇒ TimedStackMulti
Returns a new instance of TimedStackMulti.
13 14 15 16 17 18 19 20 |
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb', line 13 def initialize(size = 0, &block) super @enqueued = 0 @ques = self.class.hash_of_arrays @lru = {} @key = :"connection_args-#{object_id}" end |
Class Method Details
.hash_of_arrays ⇒ Object
Returns a new hash that has arrays for keys
Using a class method to limit the bindings referenced by the hash’s default_proc
9 10 11 |
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb', line 9 def self.hash_of_arrays # :nodoc: Hash.new { |h,k| h[k] = [] } end |
Instance Method Details
#empty? ⇒ Boolean
22 23 24 |
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb', line 22 def empty? (@created - @enqueued) >= @max end |
#length ⇒ Object
26 27 28 |
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb', line 26 def length @max - @created + @enqueued end |