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
type
is PDFByteString.
Class Method Details
.additional_types ⇒ Object
:nodoc:
234 235 236 |
# File 'lib/hexapdf/dictionary_fields.rb', line 234 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
.
240 241 242 243 |
# File 'lib/hexapdf/dictionary_fields.rb', line 240 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.
229 230 231 |
# File 'lib/hexapdf/dictionary_fields.rb', line 229 def self.usable_for?(type) type == PDFByteString end |