Module: CBOR::FloatHelper

Defined in:
lib/libcbor/helpers.rb

Overview

Provides the #to_cbor (or equivalent) method for Floats

Instance Method Summary collapse

Instance Method Details

#__libcbor_to_cborString

Encodes Floatss. Width and precision are handled automatically

Returns:

  • (String)

    The CBOR representation



22
23
24
25
# File 'lib/libcbor/helpers.rb', line 22

def __libcbor_to_cbor
	@@bfr ||= FFI::Buffer.new(:uchar, 9)
	@@bfr.get_bytes(0, LibCBOR.cbor_encode_single(self, @@bfr, 9))
end