Module: BSON::Specialized

Included in:
MaxKey, MinKey, NilClass, Undefined
Defined in:
lib/bson/specialized.rb

Overview

Provides behaviour to special values that exist in the BSON spec that don’t have a native type, like $minKey and $maxKey.

See Also:

Since:

  • 2.0.0

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ true, false

Determine if the min key is equal to another object.

Examples:

Check min key equality.

BSON::MinKey.new == object

Parameters:

  • other (Object)

    The object to check against.

Returns:

  • (true, false)

    If the objects are equal.

Since:

  • 2.0.0



37
38
39
# File 'lib/bson/specialized.rb', line 37

def ==(other)
  self.class == other.class
end

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

Encode the min key - has no value since it only needs the type and field name when being encoded.

Examples:

Encode the min key value.

min_key.to_bson

Returns:

Since:

  • 2.0.0



50
51
52
# File 'lib/bson/specialized.rb', line 50

def to_bson(buffer = ByteBuffer.new)
  buffer
end