Class: Delayed::Batch::PerformableBatch
- Inherits:
-
Struct
- Object
- Struct
- Delayed::Batch::PerformableBatch
- Defined in:
- lib/delayed/batch.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#mode ⇒ Object
Returns the value of attribute mode.
Instance Method Summary collapse
- #display_name ⇒ Object (also: #tag, #full_name)
-
#initialize(mode, items) ⇒ PerformableBatch
constructor
A new instance of PerformableBatch.
- #jobs ⇒ Object
- #perform ⇒ Object
Constructor Details
#initialize(mode, items) ⇒ PerformableBatch
Returns a new instance of PerformableBatch.
4 5 6 7 8 |
# File 'lib/delayed/batch.rb', line 4 def initialize(mode, items) raise "unsupported mode" unless mode == :serial self.mode = mode self.items = items end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items
3 4 5 |
# File 'lib/delayed/batch.rb', line 3 def items @items end |
#mode ⇒ Object
Returns the value of attribute mode
3 4 5 |
# File 'lib/delayed/batch.rb', line 3 def mode @mode end |
Instance Method Details
#display_name ⇒ Object Also known as: tag, full_name
10 11 12 |
# File 'lib/delayed/batch.rb', line 10 def display_name "Delayed::Batch.#{mode}" end |
#jobs ⇒ Object
20 21 22 |
# File 'lib/delayed/batch.rb', line 20 def jobs items.map { |opts| Delayed::Job.new(opts) } end |
#perform ⇒ Object
16 17 18 |
# File 'lib/delayed/batch.rb', line 16 def perform raise "can't perform a batch directly" end |