module BSON::BigDecimal

Injects behaviour for encoding and decoding BigDecimal values to and from # raw bytes as specified by the BSON spec.

@see bsonspec.org/#/specification

Constants

BSON_TYPE

A floating point is type 0x01 in the BSON spec.

PACK

The pack directive is for 8 byte floating points.

Public Instance Methods

to_bson(encoded = ''.force_encoding(BINARY)) click to toggle source

Get the floating point as encoded BSON. @example Get the floating point as encoded BSON.

1.221311.to_bson

@return [ String ] The encoded string. @see bsonspec.org/#/specification

# File lib/logstash/outputs/bson/big_decimal.rb, line 36
def to_bson(encoded = ''.force_encoding(BINARY))
  encoded << [ self ].pack(PACK)
end