lib/resque/plugins/dynamic_queues/queues.rb in resque-dynamic-queues-0.7.1 vs lib/resque/plugins/dynamic_queues/queues.rb in resque-dynamic-queues-0.8.0

- old
+ new

@@ -22,20 +22,24 @@ return queues_without_dynamic if queue_names.grep(/(^!)|(^@)|(\*)/).size == 0 real_queues = Resque.queues matched_queues = [] - queue_names.each do |q| + while q = queue_names.shift q = q.to_s - if q =~ /^@(.*)/ - key = $1.strip + if q =~ /^(!)?@(.*)/ + key = $2.strip key = hostname if key.size == 0 - queue_names.concat(Resque.get_dynamic_queue(key)) + + add_queues = Resque.get_dynamic_queue(key) + add_queues.map! { |q| q.gsub!(/^!/, '') || q.gsub!(/^/, '!') } if $1 + + queue_names.concat(add_queues) next end - if q[0] == '!' + if q =~ /^!/ negated = true q = q[1..-1] end patstr = q.gsub(/\*/, ".*")