Class: GoodJob::ExecutionResult

Inherits:
Object
  • Object
show all
Defined in:
app/models/good_job/execution_result.rb

Overview

Stores the results of job execution

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, handled_error: nil, unhandled_error: nil, error_event: nil, unexecutable: nil, retried_job: nil) ⇒ ExecutionResult

Returns a new instance of ExecutionResult.

Parameters:

  • value (Object, nil)
  • handled_error (Exception, nil) (defaults to: nil)
  • unhandled_error (Exception, nil) (defaults to: nil)
  • error_event (String, nil) (defaults to: nil)
  • unexecutable (Boolean, nil) (defaults to: nil)
  • retried_job (GoodJob::Job, nil) (defaults to: nil)


25
26
27
28
29
30
31
32
# File 'app/models/good_job/execution_result.rb', line 25

def initialize(value:, handled_error: nil, unhandled_error: nil, error_event: nil, unexecutable: nil, retried_job: nil)
  @value = value
  @handled_error = handled_error
  @unhandled_error = unhandled_error
  @error_event = error_event
  @unexecutable = unexecutable
  @retried_job = retried_job
end

Instance Attribute Details

#error_eventString? (readonly)

Returns:

  • (String, nil)


13
14
15
# File 'app/models/good_job/execution_result.rb', line 13

def error_event
  @error_event
end

#handled_errorException? (readonly)

Returns:

  • (Exception, nil)


9
10
11
# File 'app/models/good_job/execution_result.rb', line 9

def handled_error
  @handled_error
end

#retried_jobGoodJob::Job? (readonly)

Returns:



17
18
19
# File 'app/models/good_job/execution_result.rb', line 17

def retried_job
  @retried_job
end

#unexecutableBoolean? (readonly)

Returns:

  • (Boolean, nil)


15
16
17
# File 'app/models/good_job/execution_result.rb', line 15

def unexecutable
  @unexecutable
end

#unhandled_errorException? (readonly)

Returns:

  • (Exception, nil)


11
12
13
# File 'app/models/good_job/execution_result.rb', line 11

def unhandled_error
  @unhandled_error
end

#valueObject? (readonly)

Returns:

  • (Object, nil)


7
8
9
# File 'app/models/good_job/execution_result.rb', line 7

def value
  @value
end

Instance Method Details

#retried?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/good_job/execution_result.rb', line 40

def retried?
  retried_job.present?
end

#succeeded?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/good_job/execution_result.rb', line 35

def succeeded?
  !(handled_error || unhandled_error || unexecutable || retried?)
end