Class: Parse::Agent::ApprovalDecision
- Inherits:
-
Object
- Object
- Parse::Agent::ApprovalDecision
- Defined in:
- lib/parse/agent/approval_gate.rb
Overview
Result of an approval review: approved, denied, or unavailable.
unavailable is distinct from deny on purpose: it means the
approver could not be reached (no elicitation capability, no open
listening stream, non-streaming transport, or a timeout) rather
than "a human said no." Both fail closed — the destructive op does
not run — but the distinction is preserved in the refusal reason so
operators can tell a rejection from an unreachable approver.
Instance Attribute Summary collapse
-
#outcome ⇒ Symbol
readonly
:approve, :deny, or :unavailable.
-
#reason ⇒ String?
readonly
Human-readable reason (always set for non-approve).
Class Method Summary collapse
Instance Method Summary collapse
-
#approved? ⇒ Boolean
True only for an explicit approval.
-
#initialize(outcome, reason = nil) ⇒ ApprovalDecision
constructor
A new instance of ApprovalDecision.
Constructor Details
#initialize(outcome, reason = nil) ⇒ ApprovalDecision
Returns a new instance of ApprovalDecision.
23 24 25 26 |
# File 'lib/parse/agent/approval_gate.rb', line 23 def initialize(outcome, reason = nil) @outcome = outcome @reason = reason end |
Instance Attribute Details
#outcome ⇒ Symbol (readonly)
Returns :approve, :deny, or :unavailable.
19 20 21 |
# File 'lib/parse/agent/approval_gate.rb', line 19 def outcome @outcome end |
#reason ⇒ String? (readonly)
Returns human-readable reason (always set for non-approve).
21 22 23 |
# File 'lib/parse/agent/approval_gate.rb', line 21 def reason @reason end |
Class Method Details
.approve ⇒ Object
28 29 30 |
# File 'lib/parse/agent/approval_gate.rb', line 28 def self.approve new(:approve) end |
.deny(reason) ⇒ Object
32 33 34 |
# File 'lib/parse/agent/approval_gate.rb', line 32 def self.deny(reason) new(:deny, reason) end |
.unavailable(reason) ⇒ Object
36 37 38 |
# File 'lib/parse/agent/approval_gate.rb', line 36 def self.unavailable(reason) new(:unavailable, reason) end |
Instance Method Details
#approved? ⇒ Boolean
Returns true only for an explicit approval.
41 42 43 |
# File 'lib/parse/agent/approval_gate.rb', line 41 def approved? @outcome == :approve end |