Module: Textus::Key::Matching
- Defined in:
- lib/textus/key/matching.rb
Overview
Dotted-key scope matching, shared by all prefix-scoped sweeps (WS4 / ADR 0089-era cleanup). Canonicalised here so every consumer uses a consistent dotted-boundary check with proper Nested ancestor handling. ADR 0093: Produce is the sole engine calling this.
Class Method Summary collapse
-
.matches_prefix?(key, prefix, nested: false) ⇒ Boolean
Is
keywithin theprefixscope? - exact match, or a dotted descendant (theprefix.boundary, so prefix "art" does NOT match key "artifacts"), and - for a nested entry, also whenprefixdescends INTO it — the nested parent owns the leaf the prefix names (e.g. prefix "feeds.machines.host1" still selects the nested entry "feeds.machines").
Class Method Details
.matches_prefix?(key, prefix, nested: false) ⇒ Boolean
Is key within the prefix scope?
- exact match, or a dotted descendant (the
prefix.boundary, so prefix "art" does NOT match key "artifacts"), and - for a nested entry, also when
prefixdescends INTO it — the nested parent owns the leaf the prefix names (e.g. prefix "feeds.machines.host1" still selects the nested entry "feeds.machines").
17 18 19 20 21 |
# File 'lib/textus/key/matching.rb', line 17 def matches_prefix?(key, prefix, nested: false) return true if key == prefix || key.start_with?("#{prefix}.") nested && prefix.start_with?("#{key}.") end |