Module: BSON::Object

Defined in:
lib/bson/object.rb

Overview

Injects behaviour for all Ruby objects.

Since:

  • 2.2.4

Instance Method Summary collapse

Instance Method Details

#to_bson_key(validating_keys = Config.validating_keys?) ⇒ Object

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.

Examples:

Convert the object to a BSON key.

object.to_bson_key

Raises:

See Also:

Since:

  • 2.2.4



34
35
36
# File 'lib/bson/object.rb', line 34

def to_bson_key(validating_keys = Config.validating_keys?)
  raise InvalidKey.new(self)
end

#to_bson_normalized_keyObject

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

Examples:

Convert the object to a normalized key.

object.to_bson_normalized_key

Returns:

Since:

  • 3.0.0



46
47
48
# File 'lib/bson/object.rb', line 46

def to_bson_normalized_key
  self
end

#to_bson_normalized_valueObject

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

Examples:

Convert the object to a normalized value.

object.to_bson_normalized_value

Returns:

Since:

  • 3.0.0



58
59
60
# File 'lib/bson/object.rb', line 58

def to_bson_normalized_value
  self
end