module BSON::BigDecimal::ClassMethods
Public Instance Methods
from_bson(buffer, **options)
click to toggle source
Deserialize the BigDecimal
from raw BSON
bytes. If the :mode option is set to BSON
, this will return a BSON::Decimal128
@example Get the BigDecimal
from BSON
.
BigDecimal.from_bson(bson)
@param [ ByteBuffer
] buffer The byte buffer.
@option options [ nil | :bson ] :mode Decoding mode to use.
@return [ BigDecimal
| BSON::Decimal128
] The decimal object.
# File lib/bson/big_decimal.rb, line 60 def from_bson(buffer, **options) dec128 = Decimal128.from_bson(buffer, **options) if options[:mode] == :bson dec128 else dec128.to_d end end