Module: BSON::BigDecimal
- Defined in:
- lib/logstash/outputs/bson/big_decimal.rb
Overview
Injects behaviour for encoding and decoding BigDecimal values to and from # raw bytes as specified by the BSON spec.
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- BSON_TYPE =
A floating point is type 0x01 in the BSON spec.
1.chr.force_encoding(BINARY).freeze
- PACK =
The pack directive is for 8 byte floating points.
"E".freeze
Instance Method Summary collapse
-
#to_bson(encoded = ''.force_encoding(BINARY)) ⇒ String
Get the floating point as encoded BSON.
Instance Method Details
#to_bson(encoded = ''.force_encoding(BINARY)) ⇒ String
Get the floating point as encoded BSON.
36 37 38 |
# File 'lib/logstash/outputs/bson/big_decimal.rb', line 36 def to_bson(encoded = ''.force_encoding(BINARY)) encoded << [ self ].pack(PACK) end |