Skip to content

Commit dd70a47

Browse files
committed
Limit proc bindings of Hash default_proc
Adapted from #64 by @dominicm
1 parent d995bb9 commit dd70a47

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/net/http/persistent/timed_stack_multi.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
class Net::HTTP::Persistent::TimedStackMulti < ConnectionPool::TimedStack # :nodoc:
22

3+
##
4+
# Returns a new hash that has arrays for keys
5+
#
6+
# Using a class method to limit the bindings referenced by the hash's
7+
# default_proc
8+
9+
def self.hash_of_arrays # :nodoc:
10+
Hash.new { |h,k| h[k] = [] }
11+
end
12+
313
def initialize(size = 0, &block)
414
super
515

616
@enqueued = 0
7-
@ques = Hash.new { |h, k| h[k] = [] }
17+
@ques = self.class.hash_of_arrays
818
@lru = {}
919
@key = :"connection_args-#{object_id}"
1020
end

0 commit comments

Comments
 (0)