Class: ActiveJob::Temporal::JobDescriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/activejob/temporal/job_descriptor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_class, options = {}) ⇒ JobDescriptor

Returns a new instance of JobDescriptor.



16
17
18
19
# File 'lib/activejob/temporal/job_descriptor.rb', line 16

def initialize(job_class, options = {})
  @job_class = normalize_job_class(job_class)
  @options = options.dup
end

Instance Attribute Details

#job_classObject (readonly)

Returns the value of attribute job_class.



8
9
10
# File 'lib/activejob/temporal/job_descriptor.rb', line 8

def job_class
  @job_class
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/activejob/temporal/job_descriptor.rb', line 8

def options
  @options
end

Class Method Details

.normalize(value) ⇒ Object



10
11
12
13
14
# File 'lib/activejob/temporal/job_descriptor.rb', line 10

def self.normalize(value)
  return value.to_h if value.is_a?(self)

  nil
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
# File 'lib/activejob/temporal/job_descriptor.rb', line 21

def to_h
  {
    job_class: job_class.name,
    options: options.dup
  }
end