module BSON::Object

Injects behaviour for all Ruby objects.

@since 2.2.4

Public Instance Methods

to_bson_key(validating_keys = Config.validating_keys?) click to toggle source

Objects that don't override this method will raise an error when trying to use them as keys in a BSON document. This is only overridden in String and Symbol.

@example Convert the object to a BSON key.

object.to_bson_key

@raise [ InvalidKey ] Always raises an exception.

@see bsonspec.org/#/specification

@since 2.2.4

# File lib/bson/object.rb, line 34
def to_bson_key(validating_keys = Config.validating_keys?)
  raise InvalidKey.new(self)
end
to_bson_normalized_key() click to toggle source

Converts the object to a normalized key in a BSON document.

@example Convert the object to a normalized key.

object.to_bson_normalized_key

@return [ Object ] self.

@since 3.0.0

# File lib/bson/object.rb, line 46
def to_bson_normalized_key
  self
end
to_bson_normalized_value() click to toggle source

Converts the object to a normalized value in a BSON document.

@example Convert the object to a normalized value.

object.to_bson_normalized_value

@return [ Object ] self.

@since 3.0.0

# File lib/bson/object.rb, line 58
def to_bson_normalized_value
  self
end