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.



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

#itemsObject

Returns the value of attribute items

Returns:

  • (Object)

    the current value of items



3
4
5
# File 'lib/delayed/batch.rb', line 3

def items
  @items
end

#modeObject

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



3
4
5
# File 'lib/delayed/batch.rb', line 3

def mode
  @mode
end

Instance Method Details

#display_nameObject Also known as: tag, full_name



10
11
12
# File 'lib/delayed/batch.rb', line 10

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

#jobsObject



20
21
22
# File 'lib/delayed/batch.rb', line 20

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

#performObject



16
17
18
# File 'lib/delayed/batch.rb', line 16

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