Module: HexaPDF::DictionaryFields::FileSpecificationConverter

Defined in:
lib/hexapdf/dictionary_fields.rb

Overview

Converter module for file specification fields. A file specification in string format is converted to the corresponding file specification dictionary.

Class Method Summary collapse

Class Method Details

.additional_typesObject

FileSpecs can also be simple hashes or strings.



334
335
336
# File 'lib/hexapdf/dictionary_fields.rb', line 334

def self.additional_types
  [Hash, String]
end

.convert(data, type, document) ⇒ Object

Converts the string file specification into a full file specification.



344
345
346
# File 'lib/hexapdf/dictionary_fields.rb', line 344

def self.convert(data, type, document)
  document.wrap({F: data}, type: type.first)
end

.convert?(data, _type) ⇒ Boolean

Returns true if the given data is a string file specification.

Returns:



339
340
341
# File 'lib/hexapdf/dictionary_fields.rb', line 339

def self.convert?(data, _type)
  data.kind_of?(String)
end

.usable_for?(type) ⇒ Boolean

This converter is only used for the :FileSpec type.

Returns:



329
330
331
# File 'lib/hexapdf/dictionary_fields.rb', line 329

def self.usable_for?(type)
  type == :Filespec
end