Class: FruitJuice::DelayedJob

Inherits:
Object
  • Object
show all
Defined in:
lib/fruit_juice/delayed_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**config_options) ⇒ DelayedJob

Returns a new instance of DelayedJob.



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

def initialize(**config_options)
  raise "job_type must be a string" if config_options.has_key?(:job_type) && config_options[:job_type].class != String
  
  @redis_adapter = set_redis_adapter(config_options[:redis_adapter])
  @job_type = set_job_type(config_options[:job_type])
  @waiting_queue_key = "mosquito:waiting:#{@job_type.underscore}"
end

Instance Attribute Details

#job_typeObject (readonly)

Returns the value of attribute job_type.



11
12
13
# File 'lib/fruit_juice/delayed_job.rb', line 11

def job_type
  @job_type
end

#waiting_queue_keyObject (readonly)

Returns the value of attribute waiting_queue_key.



11
12
13
# File 'lib/fruit_juice/delayed_job.rb', line 11

def waiting_queue_key
  @waiting_queue_key
end

Instance Method Details

#perform(**job_options) ⇒ Object



21
22
23
24
# File 'lib/fruit_juice/delayed_job.rb', line 21

def perform(**job_options)
  @job_options = job_options.deep_stringify_keys!
  enqueue_job
end