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 available converter objects can be retrieved or modified via the
The methods that need to be implemented by a stateless converter objects are the following:
trueif the converter is usable for the given type.
nil, a single type class or an array of type classes which will additionally be allowed for the field.
- convert(data, type, document)
Should return the
converteddata if conversion is possible and
typeargument is the result of the
Field#typemethod call and
HexaPDF::Documentfor which the data should be converted.
Since a converter usually doesn’t need to store any data, it can be implemented as a module using class methods. This is how it is done for the built-in converter objects.