Class: ActiveJob::Temporal::BatchEnqueueItemResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index:, job:, status:, handle: nil, error: nil) ⇒ BatchEnqueueItemResult

Returns a new instance of BatchEnqueueItemResult.



25
26
27
28
29
30
31
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 25

def initialize(index:, job:, status:, handle: nil, error: nil)
  @index = index
  @job = job
  @status = status
  @handle = handle
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



23
24
25
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 23

def error
  @error
end

#handleObject (readonly)

Returns the value of attribute handle.



23
24
25
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 23

def handle
  @handle
end

#indexObject (readonly)

Returns the value of attribute index.



23
24
25
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 23

def index
  @index
end

#jobObject (readonly)

Returns the value of attribute job.



23
24
25
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 23

def job
  @job
end

#statusObject (readonly)

Returns the value of attribute status.



23
24
25
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 23

def status
  @status
end

Instance Method Details

#duplicate?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 37

def duplicate?
  status == :duplicate
end

#failure?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 41

def failure?
  status == :failed
end

#success?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 33

def success?
  status == :success
end

#to_hObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/activejob/temporal/batch_enqueue_result.rb', line 45

def to_h
  {
    index: index,
    job_class: job.class.name,
    job_id: job.job_id,
    status: status,
    handle: handle,
    error: formatted_error
  }.compact
end