Module: HexaPDF::DictionaryFields::ArrayConverter

Defined in:
lib/hexapdf/dictionary_fields.rb

Overview

Converter module for fields of type PDFArray.

This converter ensures that arrays are wrapped by the PDFArray class for more convenient use.

Class Method Summary collapse

Class Method Details

.additional_typesObject

PDFArray fields can also contain simple arrays.



227
228
229
# File 'lib/hexapdf/dictionary_fields.rb', line 227

def self.additional_types
  Array
end

.convert(data, _type, document) ⇒ Object

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



232
233
234
235
# File 'lib/hexapdf/dictionary_fields.rb', line 232

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:



222
223
224
# File 'lib/hexapdf/dictionary_fields.rb', line 222

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