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.
354 355 356 |
# File 'lib/hexapdf/dictionary_fields.rb', line 354 def self.additional_types Array end |
.convert(data, _type, document) ⇒ Object
Wraps a given array in the Rectangle class. Otherwise returns nil.
359 360 361 362 |
# File 'lib/hexapdf/dictionary_fields.rb', line 359 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 |
.usable_for?(type) ⇒ Boolean
This converter is usable if the type is Rectangle.
349 350 351 |
# File 'lib/hexapdf/dictionary_fields.rb', line 349 def self.usable_for?(type) type == Rectangle end |