Class: Textus::Domain::Policy::Predicates::HumanAccept
- Inherits:
-
Object
- Object
- Textus::Domain::Policy::Predicates::HumanAccept
- Defined in:
- lib/textus/domain/policy/predicates/human_accept.rb
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#call(store:, entry: nil) ⇒ Object
The role is passed via ‘store` (an Application::Context-like object with a `role` reader) or through the entry metadata.
- #name ⇒ Object
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
6 7 8 |
# File 'lib/textus/domain/policy/predicates/human_accept.rb', line 6 def reason @reason end |
Instance Method Details
#call(store:, entry: nil) ⇒ Object
The role is passed via ‘store` (an Application::Context-like object with a `role` reader) or through the entry metadata. In practice, Accept already enforces role == “human” before reaching the promotion gate, so this predicate trivially passes. It documents intent and future-proofs multi-actor accept flows.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/textus/domain/policy/predicates/human_accept.rb', line 17 def call(store:, entry: nil) # rubocop:disable Lint/UnusedMethodArgument role = store.respond_to?(:role) ? store.role.to_s : nil # If we cannot determine the role (e.g. store doesn't expose it), # we trust that Accept has already checked — allow through. return true if role.nil? ok = (role == "human") @reason = "current role is '#{role}', expected 'human'" unless ok ok end |
#name ⇒ Object
8 9 10 |
# File 'lib/textus/domain/policy/predicates/human_accept.rb', line 8 def name "human_accept" end |