# File lib/autumn/ctcp.rb, line 82 def initialize(options={}) @options = options @options[:reply_queue_size] ||= 10 @options[:reply_rate] ||= 0.25 @reply_thread = Hash.new @reply_queue = Hash.new do |hsh, key| hsh[key] = ForgetfulQueue.new(@options[:reply_queue_size]) @reply_thread[key] = Thread.new(key) do |stem| loop do #TODO wake thread when stem is quitting so this thread can terminate? reply = @reply_queue[stem].pop stem.notice reply[:recipient], reply[:message] sleep @options[:reply_rate] end end hsh[key] end end