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.

Constant Summary collapse

LIST_FIELDS =

Fields shown here are driven by FIELD_REGISTRY (in_rule_list); only the per-field serialization below is field-specific.

Textus::Manifest::Schema::FIELD_REGISTRY.select { |_, m| m[:in_rule_list] }.keys.freeze

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



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

def call
  @manifest.rules.blocks.map do |b|
    row = { "match" => b.match }
    LIST_FIELDS.each do |field|
      value = b.public_send(field)
      row[field.to_s] = serialize(field, value) unless value.nil?
    end
    row
  end
end