Module: Lite::Command::Internals::Results
- Defined in:
- lib/lite/command/internals/results.rb
Instance Method Summary collapse
- #cmd_id ⇒ Object
- #index ⇒ Object
- #outcome ⇒ Object
- #results ⇒ Object
- #to_hash ⇒ Object (also: #to_h)
Instance Method Details
#cmd_id ⇒ Object
14 15 16 |
# File 'lib/lite/command/internals/results.rb', line 14 def cmd_id @cmd_id ||= context.cmd_id ||= SecureRandom.uuid end |
#index ⇒ Object
10 11 12 |
# File 'lib/lite/command/internals/results.rb', line 10 def index @index ||= context.index ||= 0 end |
#outcome ⇒ Object
18 19 20 21 22 |
# File 'lib/lite/command/internals/results.rb', line 18 def outcome return state if pending? || thrown? status end |
#results ⇒ Object
24 25 26 |
# File 'lib/lite/command/internals/results.rb', line 24 def results @results ||= context.results ||= [] end |
#to_hash ⇒ Object Also known as: to_h
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lite/command/internals/results.rb', line 28 def to_hash { index:, cmd_id:, command: self.class.name, outcome:, state:, status:, reason:, metadata:, caused_by: caused_by&.index, thrown_by: thrown_by&.index, runtime: }.compact end |