Module: Lite::Command::Internals::Results

Defined in:
lib/lite/command/internals/results.rb

Instance Method Summary collapse

Instance Method Details

#outcomeObject



8
9
10
11
12
# File 'lib/lite/command/internals/results.rb', line 8

def outcome
  return state if pending? || thrown?

  status
end

#resultsObject



14
15
16
# File 'lib/lite/command/internals/results.rb', line 14

def results
  @results ||= context.results ||= []
end

#to_hashObject Also known as: to_h



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lite/command/internals/results.rb', line 18

def to_hash
  {
    index:,
    cmd_id:,
    command: self.class.name,
    outcome:,
    state:,
    status:,
    reason:,
    metadata:,
    caused_by: caused_by&.index,
    caused_exception: Utils.pretty_exception(caused_by&.original_exception),
    thrown_by: thrown_by&.index,
    thrown_exception: Utils.pretty_exception(thrown_by&.command_exception),
    runtime:
  }.compact
end