Class: BSON::Int32

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

Overview

Represents a $maxKey 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

16.chr.force_encoding(BINARY).freeze
PACK =

Constant for the int 32 pack directive.

Since:

  • 2.0.0

Environment.ruby_18? ? "l".freeze : "l<".freeze

Class Method Summary collapse

Class Method Details

.from_bson(bson) ⇒ Integer

Deserialize an Integer from BSON.

Parameters:

  • bson (BSON)

    The encoded int32.

Returns:

  • (Integer)

    The decoded Integer.

See Also:

Since:

  • 2.0.0



44
45
46
# File 'lib/bson/int32.rb', line 44

def self.from_bson(bson)
  from_bson_int32(bson.read(4))
end