Class: BSON::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/bson/boolean.rb

Overview

Represents a boolean type, which compares less than any other value in the specification.

See Also:

Since:

  • 2.0.0

Constant Summary collapse

BSON_TYPE =

A boolean is type 0x08 in the BSON spec.

Since:

  • 2.0.0

8.chr.force_encoding(BINARY).freeze

Class Method Summary collapse

Class Method Details

.from_bson(bson) ⇒ TrueClass, FalseClass

Deserialize a boolean from BSON.

Parameters:

  • bson (BSON)

    The encoded boolean.

Returns:

See Also:

Since:

  • 2.0.0



39
40
41
# File 'lib/bson/boolean.rb', line 39

def self.from_bson(bson)
  bson.readbyte.chr == TrueClass::TRUE_BYTE
end