Module: HexaPDF::DictionaryFields::ArrayConverter

Defined in:
lib/hexapdf/dictionary_fields.rb

Overview

Converter module for fields of type PDFArray.

Class Method Summary collapse

Class Method Details

.additional_typesObject

PDFArray fields can also contain simple arrays.



210
211
212
# File 'lib/hexapdf/dictionary_fields.rb', line 210

def self.additional_types
  Array
end

.convert(data, _type, document) ⇒ Object

Wraps a given array in the PDFArray class. Otherwise returns nil.



215
216
217
218
# File 'lib/hexapdf/dictionary_fields.rb', line 215

def self.convert(data, _type, document)
  return unless data.kind_of?(Array)
  document.wrap(data, type: PDFArray)
end

.usable_for?(type) ⇒ Boolean

This converter is usable if the type is PDFArray.

Returns:



205
206
207
# File 'lib/hexapdf/dictionary_fields.rb', line 205

def self.usable_for?(type)
  type == PDFArray
end