Injects behaviour for encoding and decoding symbol values to and from raw bytes as specified by the BSON spec.
@note Symbols are deprecated in the BSON spec, but they are still
currently supported here for backwards compatibility.
@see bsonspec.org/#/specification
@since 2.0.0
Get the symbol as encoded BSON.
@example Get the symbol as encoded BSON.
:test.to_bson
@return [ Symbol ] The encoded symbol.
@see bsonspec.org/#/specification
@since 2.0.0
# File lib/bson/symbol.rb, line 43 def to_bson(encoded = ''.force_encoding(BINARY)) to_s.to_bson(encoded) end
Get the symbol as a BSON key name encoded C symbol.
@example Get the symbol as a key name.
:test.to_bson_key
@return [ String ] The encoded symbol as a BSON key.
@see bsonspec.org/#/specification
@since 2.0.0
# File lib/bson/symbol.rb, line 57 def to_bson_key(encoded = ''.force_encoding(BINARY)) to_s.to_bson_key(encoded) end
Generated with the Darkfish Rdoc Generator 2.