Module: Textus::Manifest::Entry::Validators::FormatMatrix

Defined in:
lib/textus/manifest/entry/validators/format_matrix.rb

Class Method Summary collapse

Class Method Details

.call(entry, policy:) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument

Raises:



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/textus/manifest/entry/validators/format_matrix.rb', line 6

def self.call(entry, policy:) # rubocop:disable Lint/UnusedMethodArgument
  begin
    Textus::Entry.for_format(entry.format).validate_path_extension(entry.path, entry.nested?)
  rescue UsageError => e
    raise UsageError.new("entry '#{entry.key}': #{e.message}")
  end

  return unless entry.format == "text" && !entry.schema.nil?

  raise UsageError.new("entry '#{entry.key}': text format must not declare a schema")
end