module BSON::Specialized

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

@see bsonspec.org/#/specification

@since 2.0.0

Private Class Methods

included(klass) click to toggle source
# File lib/bson/specialized.rb, line 55
def self.included(klass)
  klass.extend(ClassMethods)
end

Public Instance Methods

==(other) click to toggle source

Determine if the min key is equal to another object.

@example Check min key equality.

BSON::MinKey.new == object

@param [ Object ] other The object to check against.

@return [ true, false ] If the objects are equal.

@since 2.0.0

# File lib/bson/specialized.rb, line 36
def ==(other)
  self.class == other.class
end
to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) click to toggle source

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

@example Encode the min key value.

min_key.to_bson

@return [ BSON::ByteBuffer ] The buffer with the encoded object.

@since 2.0.0

# File lib/bson/specialized.rb, line 49
def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
  buffer
end