module HexaPDF::DictionaryFields::FileSpecificationConverter

def self.additional_types

Filespecs can also be simple hashes or strings.
def self.additional_types
  [Hash, String]
end

def self.convert(data, type, document)

returns +nil+.
Converts a string file specification or a hash into a full file specification. Otherwise
def self.convert(data, type, document)
  return if data.kind_of?(type.first) ||
    !(data.kind_of?(Hash) || data.kind_of?(HexaPDF::Dictionary) || data.kind_of?(String))
  data = {F: data} if data.kind_of?(String)
  document.wrap(data, type: type.first)
end

def self.usable_for?(type)

This converter is only used for the :Filespec type.
def self.usable_for?(type)
  type == :Filespec
end