Module: HexaPDF::DictionaryFields::RectangleConverter
- Defined in:
- lib/hexapdf/dictionary_fields.rb
Overview
Converter module for fields of type Rectangle.
Class Method Summary collapse
-
.additional_types ⇒ Object
Rectangle fields can also contain simple arrays.
-
.convert(data, _type, document) ⇒ Object
Wraps a given array in the Rectangle class.
-
.usable_for?(type) ⇒ Boolean
This converter is usable if the
typeis Rectangle.
Class Method Details
.additional_types ⇒ Object
Rectangle fields can also contain simple arrays.
340 341 342 |
# File 'lib/hexapdf/dictionary_fields.rb', line 340 def self.additional_types Array end |
.convert(data, _type, document) ⇒ Object
Wraps a given array in the Rectangle class. Otherwise returns nil.
345 346 347 348 |
# File 'lib/hexapdf/dictionary_fields.rb', line 345 def self.convert(data, _type, document) return unless data.kind_of?(Array) || data.kind_of?(HexaPDF::PDFArray) data.empty? ? document.wrap(nil) : document.wrap(data, type: Rectangle) end |