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
-
.additional_types ⇒ Object
FileSpecs can also be simple hashes or strings.
-
.convert(data, type, document) ⇒ Object
Converts the string file specification into a full file specification.
-
.convert?(data, _type) ⇒ Boolean
Returns
true
if the given data is a string file specification. -
.usable_for?(type) ⇒ Boolean
This converter is only used for the :FileSpec type.
Class Method Details
.additional_types ⇒ Object
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.
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.
329 330 331 |
# File 'lib/hexapdf/dictionary_fields.rb', line 329 def self.usable_for?(type) type == :Filespec end |