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.



360
361
362
# File 'lib/hexapdf/dictionary_fields.rb', line 360

def self.additional_types
  Array
end

.convert(data, _type, document) ⇒ Object

Wraps the given data value in the Rectangle class.



370
371
372
# File 'lib/hexapdf/dictionary_fields.rb', line 370

def self.convert(data, _type, document)
  document.wrap(data, type: Rectangle)
end

.convert?(data, _type) ⇒ Boolean

Returns true if the given data value is an Array.

Returns:



365
366
367
# File 'lib/hexapdf/dictionary_fields.rb', line 365

def self.convert?(data, _type)
  data.kind_of?(Array)
end

.usable_for?(type) ⇒ Boolean

This converter is usable if the type is Rectangle.

Returns:



355
356
357
# File 'lib/hexapdf/dictionary_fields.rb', line 355

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