Sha256: 5b25625aac5e9f842d1abd00420a2e60baa3ee5e2b506974dc59cbcfa946edf1
Contents?: true
Size: 788 Bytes
Versions: 12
Compression:
Stored size: 788 Bytes
Contents
# An enumerable collection of queues that supports direct access to queues by name. # # queue_1 = ApplicationJob::Queue.new("queue_1") # queue_2 = ApplicationJob::Queue.new("queue_2") # queues = ApplicationJob::Queues.new([queue_1, queue_2]) # # queues[:queue_1] #=> queue_1 # queues[:queue_2] #=> queue_2 # queues.to_a #=> [ queue_1, queue_2 ] # Enumerable # # See +ActiveJob::Queue+. class ActiveJob::Queues include Enumerable delegate :each, to: :values delegate :values, to: :queues_by_name, private: true delegate :[], :size, :length, :to_s, :inspect, to: :queues_by_name def initialize(queues) @queues_by_name = queues.index_by(&:name).with_indifferent_access end def to_h queues_by_name.dup end private attr_reader :queues_by_name end
Version data entries
12 entries across 12 versions & 1 rubygems