Class: Textus::Manifest::Policy::Predicates::TargetIsCanon

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/manifest/policy/predicates/target_is_canon.rb

Class Method Summary collapse

Class Method Details

.call(manifest:, actor:, action:, key:, schemas: nil, envelope: nil, extra: {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/textus/manifest/policy/predicates/target_is_canon.rb', line 6

def self.call(manifest:, actor:, action:, key:, schemas: nil, envelope: nil, extra: {})
  return { pass: true } if key.nil?

  mentry = manifest.resolver.resolve(key).entry
  kind = manifest.policy.declared_kind(mentry.lane.to_s)
  pass = kind == :canon
  { pass:, reason: pass ? nil : "target lane '#{mentry.lane}' is not canon (kind: #{kind})" }
rescue Textus::UnknownKey
  { pass: true }
end