module HexaPDF::DictionaryFields::RectangleConverter

Converter module for fields of type Rectangle.

Public Class Methods

additional_types() click to toggle source

Rectangle fields can also contain simple arrays.

# File lib/hexapdf/dictionary_fields.rb, line 339
def self.additional_types
  Array
end
convert(data, _type, document) click to toggle source

Wraps a given array in the Rectangle class. Otherwise returns nil.

# File lib/hexapdf/dictionary_fields.rb, line 344
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) click to toggle source

This converter is usable if the type is Rectangle.

# File lib/hexapdf/dictionary_fields.rb, line 334
def self.usable_for?(type)
  type == Rectangle
end