Module: HexaPDF::DictionaryFields::PDFByteStringConverter
- Defined in:
- lib/hexapdf/dictionary_fields.rb
Overview
Converter module for binary string fields to automatically convert a string into binary encoding.
Class Method Summary collapse
-
.additional_types ⇒ Object
:nodoc:.
-
.convert(str, _type, _document) ⇒ Object
Converts the string into binary encoding, assuming it is a non-binary string.
-
.usable_for?(type) ⇒ Boolean
This converter is usable if the
typeis PDFByteString.
Class Method Details
.additional_types ⇒ Object
:nodoc:
263 264 265 |
# File 'lib/hexapdf/dictionary_fields.rb', line 263 def self.additional_types String end |
.convert(str, _type, _document) ⇒ Object
Converts the string into binary encoding, assuming it is a non-binary string. Otherwise returns nil.
269 270 271 272 |
# File 'lib/hexapdf/dictionary_fields.rb', line 269 def self.convert(str, _type, _document) return if !str.kind_of?(String) || str.encoding == Encoding::BINARY str.force_encoding(Encoding::BINARY) end |
.usable_for?(type) ⇒ Boolean
This converter is usable if the type is PDFByteString.
258 259 260 |
# File 'lib/hexapdf/dictionary_fields.rb', line 258 def self.usable_for?(type) type == PDFByteString end |