Module: HexaPDF::DictionaryFields::RectangleConverter

Defined in:
lib/hexapdf/dictionary_fields.rb

Overview

Converter module for fields of type Rectangle.

Class Method Summary collapse

Class Method Details

.additional_typesObject

Rectangle fields can also contain simple arrays.



316
317
318
# File 'lib/hexapdf/dictionary_fields.rb', line 316

def self.additional_types
  Array
end

.convert(data, _type, document) ⇒ Object

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



321
322
323
324
# File 'lib/hexapdf/dictionary_fields.rb', line 321

def self.convert(data, _type, document)
  return unless data.kind_of?(Array)
  document.wrap(data, type: Rectangle)
end

.usable_for?(type) ⇒ Boolean

This converter is usable if the type is Rectangle.

Returns:



311
312
313
# File 'lib/hexapdf/dictionary_fields.rb', line 311

def self.usable_for?(type)
  type == Rectangle
end