Module: HexaPDF::DictionaryFields::IntegerConverter

Defined in:
lib/hexapdf/dictionary_fields.rb

Overview

Converter module for fields of type Integer.

Class Method Summary collapse

Class Method Details

.additional_typesObject

:nodoc:



402
403
# File 'lib/hexapdf/dictionary_fields.rb', line 402

def self.additional_types
end

.convert(data, _type, _document) ⇒ Object

Converts a Float value into an Integer if the float is equal to its integer value. Otherwise returns nil



407
408
409
410
# File 'lib/hexapdf/dictionary_fields.rb', line 407

def self.convert(data, _type, _document)
  return unless data.kind_of?(Float) && data == data.to_i
  data.to_i
end

.usable_for?(type) ⇒ Boolean

This converter is usable if the type is Integer.

Returns:



397
398
399
# File 'lib/hexapdf/dictionary_fields.rb', line 397

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