Module: HexaPDF::DictionaryFields::IntegerConverter
- Defined in:
- lib/hexapdf/dictionary_fields.rb
Overview
Converter module for fields of type Integer.
Class Method Summary collapse
-
.additional_types ⇒ Object
:nodoc:.
-
.convert(data, _type, _document) ⇒ Object
Converts a Float value into an Integer if the float is equal to its integer value.
-
.usable_for?(type) ⇒ Boolean
This converter is usable if the
typeis Integer.
Class Method Details
.additional_types ⇒ Object
:nodoc:
375 376 |
# File 'lib/hexapdf/dictionary_fields.rb', line 375 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
380 381 382 383 |
# File 'lib/hexapdf/dictionary_fields.rb', line 380 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.
370 371 372 |
# File 'lib/hexapdf/dictionary_fields.rb', line 370 def self.usable_for?(type) type == Integer end |