Class: Textus::Read::RuleList

Inherits:
Object
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/read/rule_list.rb

Overview

Enumerate every declared rule block in the manifest, in order. This is the whole-manifest view; ‘rule_explain` is the for-key view. Extracted from the CLI verb so the rule family is fully use-case-backed (ADR 0059); CLI-only (no MCP contract) — an agent reasons per-key via rule_explain.

Instance Method Summary collapse

Methods included from Contract::DSL

arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view

Constructor Details

#initialize(container:, call: nil) ⇒ RuleList

rubocop:disable Lint/UnusedMethodArgument



16
17
18
# File 'lib/textus/read/rule_list.rb', line 16

def initialize(container:, call: nil) # rubocop:disable Lint/UnusedMethodArgument
  @manifest = container.manifest
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/textus/read/rule_list.rb', line 20

def call
  @manifest.rules.blocks.map do |b|
    row = { "match" => b.match }
    if b.lifecycle
      row["lifecycle"] = {
        "ttl_seconds" => b.lifecycle.ttl_seconds,
        "on_expire" => b.lifecycle.on_expire,
        "budget_ms" => b.lifecycle.budget_ms,
      }
    end
    row["handler_allowlist"] = b.handler_allowlist.handlers if b.handler_allowlist
    row["guard"] = b.guard if b.guard
    row
  end
end