Sha256: 528c3700a8666ec4b82489a185f8f3889aae36e12f51814f8c6376ffb627e356

Contents?: true

Size: 460 Bytes

Versions: 3

Compression:

Stored size: 460 Bytes

Contents

module Cborb::Decoding::Types
  # To represent part of major type: 7
  # 
  # @see https://tools.ietf.org/html/rfc7049#section-2.3
  class FloatingPoint < Type
    UNPACK_TEMPLATES = [
      "g".freeze,
      "G".freeze,
    ].freeze

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cborb-0.3.0 lib/cborb/decoding/types/floating_point.rb
cborb-0.2.0 lib/cborb/decoding/types/floating_point.rb
cborb-0.1.0 lib/cborb/decoding/types/floating_point.rb