Class: BufferedLogger::ThreadHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/buffered_logger/thread_hash.rb

Instance Method Summary collapse

Instance Method Details

#[]=(k, v) ⇒ Object



3
4
5
6
# File 'lib/buffered_logger/thread_hash.rb', line 3

def []=(k,v)
  sweep if !include?(k) && k.is_a?(Thread)
  super
end

#sweepObject



8
9
10
# File 'lib/buffered_logger/thread_hash.rb', line 8

def sweep
  self.delete_if { |k,v| k.is_a?(Thread) && !k.alive? }
end