Module: BSON::TrueClass
- Defined in:
- lib/bson/true_class.rb
Overview
Injects behaviour for encoding and decoding true values to and from raw bytes as specified by the BSON spec.
Constant Summary collapse
- TRUE_BYTE =
A true value in the BSON spec is 0x01.
::String.new(1.chr, encoding: BINARY).freeze
Instance Method Summary collapse
-
#bson_type ⇒ String
The BSON type for true values is the general boolean type of 0x08.
-
#to_bson(buffer = ByteBuffer.new) ⇒ BSON::ByteBuffer
Get the true boolean as encoded BSON.
Instance Method Details
#bson_type ⇒ String
The BSON type for true values is the general boolean type of 0x08.
40 41 42 |
# File 'lib/bson/true_class.rb', line 40 def bson_type Boolean::BSON_TYPE end |
#to_bson(buffer = ByteBuffer.new) ⇒ BSON::ByteBuffer
Get the true boolean as encoded BSON.
54 55 56 |
# File 'lib/bson/true_class.rb', line 54 def to_bson(buffer = ByteBuffer.new) buffer.put_byte(TRUE_BYTE) end |