Class: Textus::Domain::Policy::Predicates::EtagMatch
- Inherits:
-
Object
- Object
- Textus::Domain::Policy::Predicates::EtagMatch
- Defined in:
- lib/textus/domain/policy/predicates/etag_match.rb
Overview
Advisory pre-flight etag check for policy explain. The authoritative compare-and-write stays in Envelope::IO::Writer (atomic write-then-audit, ADR 0017). Passes when no if_etag is supplied (params nil) — guard does not require it.
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
- #call(eval) ⇒ Object
-
#initialize(if_etag: nil) ⇒ EtagMatch
constructor
A new instance of EtagMatch.
- #name ⇒ Object
Constructor Details
#initialize(if_etag: nil) ⇒ EtagMatch
Returns a new instance of EtagMatch.
14 15 16 |
# File 'lib/textus/domain/policy/predicates/etag_match.rb', line 14 def initialize(if_etag: nil) @if_etag = if_etag end |
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
12 13 14 |
# File 'lib/textus/domain/policy/predicates/etag_match.rb', line 12 def reason @reason end |
Instance Method Details
#call(eval) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/textus/domain/policy/predicates/etag_match.rb', line 20 def call(eval) return true if @if_etag.nil? return true if eval.envelope.nil? # creating; Writer handles race return true if eval.envelope.etag == @if_etag @reason = "etag mismatch: wanted #{@if_etag}, have #{eval.envelope.etag}" false end |
#name ⇒ Object
18 |
# File 'lib/textus/domain/policy/predicates/etag_match.rb', line 18 def name = "etag_match" |