module BSON::BigDecimal
Injects behaviour for encoding and decoding BigDecimals to and from raw bytes as specified by the BSON spec.
Constants
- BSON_TYPE
-
BigDecimals are serialized as Decimal128s under the hood. A
Decimal128is type 0x13 in theBSONspec.
Public Instance Methods
Source
# File lib/bson/big_decimal.rb, line 42 def bson_type BSON_TYPE end
Get the BSON type for BigDecimal. This is the same BSON type as BSON::Decimal128.
Source
# File lib/bson/big_decimal.rb, line 36 def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) BSON::Decimal128.new(to_s).to_bson(buffer, validating_keys) end
Get the BigDecimal as encoded BSON.
@example Get the BigDecimal as encoded BSON.
BigDecimal("1").to_bson
@return [ BSON::ByteBuffer ] The buffer with the encoded object.