Class: Aidp::Execute::DeterministicUnits::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/execute/deterministic_unit.rb

Overview

Result wrapper returned after executing a deterministic unit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, status:, output_path:, started_at:, finished_at:, data: {}, error: nil) ⇒ Result

Returns a new instance of Result.



92
93
94
95
96
97
98
99
100
101
# File 'lib/aidp/execute/deterministic_unit.rb', line 92

def initialize(name:, status:, output_path:, started_at:, finished_at:, data: {}, error: nil)
  @name = name
  @status = status.to_sym
  @output_path = output_path
  @started_at = started_at
  @finished_at = finished_at
  @duration = finished_at - started_at
  @data = data
  @error = error
end

Instance Attribute Details

#data ⇒ Object (readonly)

Returns the value of attribute data.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def data
  @data
end

#duration ⇒ Object (readonly)

Returns the value of attribute duration.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def duration
  @duration
end

#error ⇒ Object (readonly)

Returns the value of attribute error.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def error
  @error
end

#finished_at ⇒ Object (readonly)

Returns the value of attribute finished_at.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def finished_at
  @finished_at
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def name
  @name
end

#output_path ⇒ Object (readonly)

Returns the value of attribute output_path.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def output_path
  @output_path
end

#started_at ⇒ Object (readonly)

Returns the value of attribute started_at.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def started_at
  @started_at
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



89
90
91
# File 'lib/aidp/execute/deterministic_unit.rb', line 89

def status
  @status
end

Instance Method Details

#failure? ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/aidp/execute/deterministic_unit.rb', line 107

def failure?
  status == :failure
end

#success? ⇒ Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/aidp/execute/deterministic_unit.rb', line 103

def success?
  status == :success
end

#timeout? ⇒ Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/aidp/execute/deterministic_unit.rb', line 111

def timeout?
  status == :timeout
end