Class: BSON::Boolean
- Inherits:
-
Object
- Object
- BSON::Boolean
- Defined in:
- lib/bson/boolean.rb
Overview
Represents a boolean type, which compares less than any other value in the specification.
Constant Summary collapse
- BSON_TYPE =
A boolean is type 0x08 in the BSON spec.
::String.new(8.chr, encoding: BINARY).freeze
Class Method Summary collapse
-
.from_bson(buffer, **options) ⇒ TrueClass, FalseClass
Deserialize a boolean from BSON.
Class Method Details
.from_bson(buffer, **options) ⇒ TrueClass, FalseClass
Deserialize a boolean from BSON.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bson/boolean.rb', line 43 def self.from_bson(buffer, **) case v = buffer.get_byte when TrueClass::TRUE_BYTE true when FalseClass::FALSE_BYTE false else raise Error::BSONDecodeError, "Invalid boolean byte value: #{v}" end end |