Class: Dalliance::Workers::DelayedJob

Inherits:
Struct
  • Object
show all
Defined in:
lib/dalliance/workers/delayed_job.rb,
lib/dalliance/workers/delayed_job.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#instance_idObject

Returns the value of attribute instance_id

Returns:

  • (Object)

    the current value of instance_id



26
27
28
# File 'lib/dalliance/workers/delayed_job.rb', line 26

def instance_id
  @instance_id
end

#instance_klassObject

Returns the value of attribute instance_klass

Returns:

  • (Object)

    the current value of instance_klass



26
27
28
# File 'lib/dalliance/workers/delayed_job.rb', line 26

def instance_klass
  @instance_klass
end

#perform_methodObject

Returns the value of attribute perform_method

Returns:

  • (Object)

    the current value of perform_method



26
27
28
# File 'lib/dalliance/workers/delayed_job.rb', line 26

def perform_method
  @perform_method
end

Class Method Details

.enqueue(instance, queue = 'dalliance', perform_method) ⇒ Object



7
8
9
10
11
# File 'lib/dalliance/workers/delayed_job.rb', line 7

def self.enqueue(instance, queue = 'dalliance', perform_method)
  Dalliance::Workers::DelayedJob
    .set(queue: queue)
    .perform_later(instance.class.name, instance.id, perform_method.to_s)
end

.rescue_error?Boolean

Delayed job automatically retries, so rescue the error

Returns:

  • (Boolean)


21
22
23
# File 'lib/dalliance/workers/delayed_job.rb', line 21

def self.rescue_error?
  true
end

Instance Method Details

#performObject



13
14
15
16
17
18
# File 'lib/dalliance/workers/delayed_job.rb', line 13

def perform(instance_klass, instance_id, perform_method)
  instance_klass
    .constantize
    .find(instance_id)
    .send(perform_method, true)
end