Module: BSON::FalseClass

Defined in:
lib/bson/false_class.rb

Overview

Injects behaviour for encoding and decoding false values to and from raw bytes as specified by the BSON spec.

See Also:

Since:

  • 2.0.0

Constant Summary collapse

FALSE_BYTE =

A false value in the BSON spec is 0x00.

Since:

  • 2.0.0

String.new(0.chr, encoding: BINARY).freeze

Instance Method Summary collapse

Instance Method Details

#bson_typeString

The BSON type for false values is the general boolean type of 0x08.

Examples:

Get the bson type.

false.bson_type

Returns:

  • (String)

    The character 0x08.

Since:

  • 2.0.0



40
41
42
# File 'lib/bson/false_class.rb', line 40

def bson_type
  Boolean::BSON_TYPE
end

#to_bson(buffer = ByteBuffer.new) ⇒ BSON::ByteBuffer

Get the false boolean as encoded BSON.

Examples:

Get the false boolean as encoded BSON.

false.to_bson

Returns:

See Also:

Since:

  • 2.0.0



54
55
56
# File 'lib/bson/false_class.rb', line 54

def to_bson(buffer = ByteBuffer.new)
  buffer.put_byte(FALSE_BYTE)
end