Class: Kobako::Wire::Envelope::Outcome
- Inherits:
-
Data
- Object
- Data
- Kobako::Wire::Envelope::Outcome
- Defined in:
- lib/kobako/wire/envelope/payloads.rb
Overview
Outcome (SPEC.md Outcome Envelope)
OUTCOME_BUFFER wrapper: one-byte tag (0x01 Result, 0x02 Panic) followed by the msgpack payload of the corresponding envelope. Callers construct an Outcome by wrapping the payload directly —+Outcome.new(Result.new(value))+ or Outcome.new(panic) — so the contract reads symmetrically across both variants.
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
-
#initialize(payload:) ⇒ Outcome
constructor
A new instance of Outcome.
- #panic? ⇒ Boolean
- #result? ⇒ Boolean
Constructor Details
#initialize(payload:) ⇒ Outcome
Returns a new instance of Outcome.
98 99 100 101 102 103 104 |
# File 'lib/kobako/wire/envelope/payloads.rb', line 98 def initialize(payload:) unless payload.is_a?(Result) || payload.is_a?(Panic) raise ArgumentError, "Outcome payload must be Result or Panic, got #{payload.class}" end super end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload
97 98 99 |
# File 'lib/kobako/wire/envelope/payloads.rb', line 97 def payload @payload end |