Class: Preflight::Rules::PdfxOutputIntentHasKeys
- Inherits:
-
Object
- Object
- Preflight::Rules::PdfxOutputIntentHasKeys
- 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.
Arguments: none
Usage:
class MyPreflight
include Preflight::Profile
rule Preflight::Rules::PdfxOutputIntentHasKeys, :OutputConditionIdentifier, :Info
end
Instance Method Summary collapse
- #check_hash(ohash) ⇒ Object
-
#initialize(*keys) ⇒ PdfxOutputIntentHasKeys
constructor
A new instance of PdfxOutputIntentHasKeys.
Constructor Details
#initialize(*keys) ⇒ PdfxOutputIntentHasKeys
Returns a new instance of PdfxOutputIntentHasKeys.
24 25 26 |
# File 'lib/preflight/rules/pdfx_output_intent_has_keys.rb', line 24 def initialize(*keys) @keys = keys.flatten end |
Instance Method Details
#check_hash(ohash) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/preflight/rules/pdfx_output_intent_has_keys.rb', line 28 def check_hash(ohash) oi = pdfx_output_intent(ohash) return [] if oi.nil? missing = @keys - oi.keys missing.map { |key| Issue.new("The GTS_PDFX OutputIntent missing required key #{key}", self, :key => key) } end |