Module: Textus::Manifest::Entry::Validators::Ignore
- Defined in:
- lib/textus/manifest/entry/validators/ignore.rb
Overview
Validates the per-entry ‘ignore:` field (ADR 0042): a list of non-empty glob strings, allowed only on nested entries.
Class Method Summary collapse
-
.call(entry, policy: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
Class Method Details
.call(entry, policy: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/textus/manifest/entry/validators/ignore.rb', line 8 def self.call(entry, policy: nil) # rubocop:disable Lint/UnusedMethodArgument patterns = entry.raw["ignore"] return if patterns.nil? raise UsageError.new("entry '#{entry.key}': ignore requires nested: true") unless entry.nested? raise UsageError.new("entry '#{entry.key}': ignore must be a list of glob strings") unless patterns.is_a?(Array) patterns.each do |pat| next if pat.is_a?(String) && !pat.empty? raise UsageError.new( "entry '#{entry.key}': each ignore pattern must be a non-empty string (got #{pat.inspect})", ) end end |