module HexaPDF::DictionaryFields::FileSpecificationConverter
Converter module for file specification fields. A file specification in string format is converted to the corresponding file specification dictionary.
Public Class Methods
additional_types()
click to toggle source
Filespecs can also be simple hashes or strings.
# File lib/hexapdf/dictionary_fields.rb, line 314 def self.additional_types [Hash, String] end
convert(data, type, document)
click to toggle source
Converts a string file specification or a hash into a full file specification. Otherwise returns nil
.
# File lib/hexapdf/dictionary_fields.rb, line 320 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
usable_for?(type)
click to toggle source
This converter is only used for the :Filespec type.
# File lib/hexapdf/dictionary_fields.rb, line 309 def self.usable_for?(type) type == :Filespec end