Class: Preflight::Rules::PdfxOutputIntentHasKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/preflight/rules/pdfx_output_intent_has_keys.rb

Overview

All PDFX files MUST have a GTS_PDFX OutputIntent with certain keys GTS_PDFX OutputIntent.

This doesn’t raise an error if there is no GTS_PDFX, that’s another rules job.

Instance Method Summary collapse

Constructor Details

#initialize(*keys) ⇒ PdfxOutputIntentHasKeys

Returns a new instance of PdfxOutputIntentHasKeys.



14
15
16
# File 'lib/preflight/rules/pdfx_output_intent_has_keys.rb', line 14

def initialize(*keys)
  @keys = keys.flatten
end

Instance Method Details

#messages(ohash) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/preflight/rules/pdfx_output_intent_has_keys.rb', line 18

def messages(ohash)
  oi = pdfx_output_intent(ohash)

  return [] if oi.nil?

  missing = @keys - oi.keys
  missing.map { |key|
    "The GTS_PDFX OutputIntent missing require key #{key}"
  }
end