Module: BSON::Float
- Defined in:
- lib/bson/float.rb
Overview
Injects behaviour for encoding and decoding floating point 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(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) ⇒ BSON::ByteBuffer
Get the floating point as encoded BSON.
Instance Method Details
#to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) ⇒ BSON::ByteBuffer
Get the floating point as encoded BSON.
45 46 47 |
# File 'lib/bson/float.rb', line 45 def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) buffer.put_double(self) end |