Class: Textus::Read::Rules

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

Overview

Effective rule set (fetch + guard) for a key. Was the inlined MCP ‘rules` tool; promoted to a first-class verb so MCP is a pure projection (ADR 0039).

Instance Method Summary collapse

Methods included from Contract::DSL

arg, contract, contract?, response, summary, surfaces, verb

Constructor Details

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

rubocop:disable Lint/UnusedMethodArgument



14
15
16
# File 'lib/textus/read/rules.rb', line 14

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

Instance Method Details

#call(key) ⇒ Object



18
19
20
21
# File 'lib/textus/read/rules.rb', line 18

def call(key)
  set = @manifest.rules.for(key)
  { "fetch" => set.fetch&.to_h, "guard" => set.guard }.compact
end