Module: Qmore::Reservers::Strategies::Filtering
- Extended by:
- Attributes
- Defined in:
- lib/qmore/reservers/strategies/filtering.rb
Class Method Summary collapse
-
.default(queues, regexes) ⇒ Object
Return an enumerator of the filtered queues in in prioritized order.
Methods included from Attributes
expand_queues, prioritize_queues
Class Method Details
.default(queues, regexes) ⇒ Object
Return an enumerator of the filtered queues in in prioritized order.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/qmore/reservers/strategies/filtering.rb', line 8 def self.default(queues, regexes) Enumerator.new do |yielder| # Map queues to their names mapped_queues = queues.reduce({}) do |hash,queue| hash[queue.name] = queue hash end # Filter the queue names against the regexes provided. matches = Filtering.(regexes, mapped_queues.keys) # Prioritize the queues. prioritized_names = Filtering.prioritize_queues(Qmore.configuration.priority_buckets, matches) prioritized_names.each do |name| yielder << mapped_queues[name] end end end |