Class: Delayed::Batch::PerformableBatch

Inherits:
Struct
  • Object
show all
Defined in:
lib/delayed/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mode, items) ⇒ PerformableBatch

Returns a new instance of PerformableBatch.



6
7
8
9
10
# File 'lib/delayed/batch.rb', line 6

def initialize(mode, items)
  raise "unsupported mode" unless mode == :serial
  self.mode   = mode
  self.items  = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items

Returns:

  • (Object)

    the current value of items



5
6
7
# File 'lib/delayed/batch.rb', line 5

def items
  @items
end

#modeObject

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



5
6
7
# File 'lib/delayed/batch.rb', line 5

def mode
  @mode
end

Instance Method Details

#display_nameObject Also known as: tag, full_name



12
13
14
# File 'lib/delayed/batch.rb', line 12

def display_name
  "Delayed::Batch.#{mode}"
end

#jobsObject



22
23
24
# File 'lib/delayed/batch.rb', line 22

def jobs
  items.map { |opts| Delayed::Job.new(**opts) }
end

#performObject



18
19
20
# File 'lib/delayed/batch.rb', line 18

def perform
  raise "can't perform a batch directly"
end