Module: HexaPDF::DictionaryFields
- Included in:
- Dictionary
- Defined in:
- lib/hexapdf/dictionary_fields.rb
Overview
A mixin used by Dictionary that implements the infrastructure and classes for defining fields.
The class responsible for holding the field information is the Field class. Additionally, each field object is automatically assigned a stateless converter object that knows if data read from a PDF file potentially needs to be converted into a standard format before use.
The methods that need to be implemented by such stateless converter objects are:
- usable_for?(type)
-
Should return
true
if the converter is usable for the given type. - additional_types
-
Should return
nil
, a single type class or an array of type classes which will additionally be allowed for the field. - convert?(data, type)
-
Should return
true
if the givendata
object can be converted. Thetype
argument is the result of the Field#type method call. - convert(data, type, document)
-
Should return the
converted
data. Thetype
argument is the result of the Field#type method call anddocument
is the HexaPDF::Document for which the data should be converted.
Defined Under Namespace
Modules: DateConverter, DictionaryConverter, FileSpecificationConverter, IdentityConverter, PDFByteStringConverter, RectangleConverter, StringConverter Classes: Field
Constant Summary collapse
- Boolean =
This constant should always be used for boolean fields.
[TrueClass, FalseClass].freeze
- PDFByteString =
PDFByteString is used for defining fields with strings in binary encoding.
Class.new { private_class_method :new }
- PDFDate =
PDFDate is used for defining fields which store a date object as a string.
Class.new { private_class_method :new }