Class: Textus::Read::RuleExplain
- Inherits:
-
Object
- Object
- Textus::Read::RuleExplain
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/read/rule_explain.rb
Overview
Effective rules for a key, at two depths (ADR 0059). Lean by default —‘{ lifecycle, guard }`, the agent-cheap read that was the `rules` verb. With `detail: true` it returns the verbose explanation — every matching policy block plus the per-transition guard predicate names — that was `policy_explain`. One verb, one name across CLI/MCP/method; the audience split is a parameter, not two tools.
Constant Summary collapse
- REGISTRY =
Textus::Manifest::Schema::FIELD_REGISTRY
- LEAN_FIELDS =
Field membership is registry-driven (WS3). Lean shows the fields tagged for :lean; detail’s matched_blocks flag every :detail field. The ‘effective` value-block shows the instantiated-policy fields (those with a policy_class) — guard, being a raw deferred field, is surfaced through the dedicated `guards:` predicate section instead.
REGISTRY.select { |_, m| m[:in_rule_explain].include?(:lean) }.keys.freeze
- DETAIL_FIELDS =
REGISTRY.select { |_, m| m[:in_rule_explain].include?(:detail) }.keys.freeze
- EFFECTIVE_FIELDS =
DETAIL_FIELDS.select { |f| REGISTRY[f][:policy_class] }.freeze
Instance Method Summary collapse
- #call(key, detail: false) ⇒ Object
-
#initialize(container:, call: nil) ⇒ RuleExplain
constructor
rubocop:disable Lint/UnusedMethodArgument.
Methods included from Contract::DSL
arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view
Constructor Details
#initialize(container:, call: nil) ⇒ RuleExplain
rubocop:disable Lint/UnusedMethodArgument
22 23 24 25 |
# File 'lib/textus/read/rule_explain.rb', line 22 def initialize(container:, call: nil) # rubocop:disable Lint/UnusedMethodArgument @manifest = container.manifest @schemas = container.schemas end |
Instance Method Details
#call(key, detail: false) ⇒ Object
37 38 39 |
# File 'lib/textus/read/rule_explain.rb', line 37 def call(key, detail: false) detail ? explain(key) : effective(key) end |