Class: Cborb::Decoding::Types::FloatingPoint

Inherits:
Type
  • Object
show all
Defined in:
lib/cborb/decoding/types/floating_point.rb

Overview

To represent part of major type: 7

Constant Summary collapse

UNPACK_TEMPLATES =
[
  "g".freeze,
  "G".freeze,
].freeze

Class Method Summary collapse

Methods inherited from Type

accept, indefinite?

Class Method Details

.decode(state, additional_info) ⇒ Object



11
12
13
14
15
16
# File 'lib/cborb/decoding/types/floating_point.rb', line 11

def self.decode(state, additional_info)
  index = additional_info - 26
  bytesize = 4 * (index + 1)

  state.accept_value(self, state.consume(bytesize).unpack(UNPACK_TEMPLATES[index]).first)
end