Class: Textus::Application::Policy::Predicates::HumanAccept
- Inherits:
-
Object
- Object
- Textus::Application::Policy::Predicates::HumanAccept
- Defined in:
- lib/textus/application/policy/predicates/human_accept.rb
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#call(role:, entry: nil) ⇒ Object
The role is passed explicitly.
- #name ⇒ Object
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
6 7 8 |
# File 'lib/textus/application/policy/predicates/human_accept.rb', line 6 def reason @reason end |
Instance Method Details
#call(role:, entry: nil) ⇒ Object
The role is passed explicitly. 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.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/textus/application/policy/predicates/human_accept.rb', line 16 def call(role:, entry: nil) # rubocop:disable Lint/UnusedMethodArgument role_str = role&.to_s # If we cannot determine the role, trust that Accept has already # checked — allow through. return true if role_str.nil? || role_str.empty? ok = (role_str == "human") @reason = "current role is '#{role_str}', expected 'human'" unless ok ok end |
#name ⇒ Object
8 9 10 |
# File 'lib/textus/application/policy/predicates/human_accept.rb', line 8 def name "human_accept" end |