Class: BackgroundJobs::JobRegistry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/background_jobs/job_registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#register_callback=(value) ⇒ Object (writeonly)

Sets the attribute register_callback

Parameters:

  • value

    the value to set the attribute register_callback to.



25
26
27
# File 'lib/background_jobs/job_registry.rb', line 25

def register_callback=(value)
  @register_callback = value
end

Instance Method Details

#get_class!(job_name) ⇒ Object

Raises:



33
34
35
36
37
# File 'lib/background_jobs/job_registry.rb', line 33

def get_class!(job_name)
  raise UnknownJob.new(job_name) unless  = get(job_name)

  .clazz
end

#get_type(job_name) ⇒ Object

Raises:



39
40
41
42
43
# File 'lib/background_jobs/job_registry.rb', line 39

def get_type(job_name)
  raise UnknownJob.new(job_name) unless  = get(job_name)

  .type
end

#register_job(job_metadata) ⇒ Object



27
28
29
30
31
# File 'lib/background_jobs/job_registry.rb', line 27

def register_job()
  jobs[.name] = 
  
  @register_callback.call() if @register_callback
end