Class: SolidQueue::QueueSelector
- Inherits:
-
Object
- Object
- SolidQueue::QueueSelector
- Defined in:
- app/models/solid_queue/queue_selector.rb
Instance Attribute Summary collapse
-
#raw_queues ⇒ Object
readonly
Returns the value of attribute raw_queues.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
-
#initialize(queue_list, relation) ⇒ QueueSelector
constructor
A new instance of QueueSelector.
- #scoped_relations ⇒ Object
Constructor Details
#initialize(queue_list, relation) ⇒ QueueSelector
Returns a new instance of QueueSelector.
7 8 9 10 |
# File 'app/models/solid_queue/queue_selector.rb', line 7 def initialize(queue_list, relation) @raw_queues = Array(queue_list).map { |queue| queue.to_s.strip }.presence || [ "*" ] @relation = relation end |
Instance Attribute Details
#raw_queues ⇒ Object (readonly)
Returns the value of attribute raw_queues.
5 6 7 |
# File 'app/models/solid_queue/queue_selector.rb', line 5 def raw_queues @raw_queues end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
5 6 7 |
# File 'app/models/solid_queue/queue_selector.rb', line 5 def relation @relation end |
Instance Method Details
#scoped_relations ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/models/solid_queue/queue_selector.rb', line 12 def scoped_relations case when all? then [ relation.all ] when none? then [ relation.none ] else queue_names.map { |queue_name| relation.queued_as(queue_name) } end end |