Module: BSON::Symbol
- Defined in:
- lib/bson/symbol.rb
Overview
Note:
Symbols are deprecated in the BSON spec, but they are still currently supported here for backwards compatibility.
Injects behaviour for encoding and decoding symbol values to and from raw bytes as specified by the BSON spec.
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- BSON_TYPE =
A symbol is type 0x0E in the BSON spec.
14.chr.force_encoding(BINARY).freeze
Instance Method Summary collapse
-
#to_bson(encoded = ''.force_encoding(BINARY)) ⇒ Symbol
Get the symbol as encoded BSON.
-
#to_bson_key(encoded = ''.force_encoding(BINARY)) ⇒ String
Get the symbol as a BSON key name encoded C symbol.
-
#to_bson_normalized_key ⇒ String
Converts the symbol to a normalized key in a BSON document.
Instance Method Details
#to_bson(encoded = ''.force_encoding(BINARY)) ⇒ Symbol
Get the symbol as encoded BSON.
43 44 45 |
# File 'lib/bson/symbol.rb', line 43 def to_bson(encoded = ''.force_encoding(BINARY)) to_s.to_bson(encoded) end |
#to_bson_key(encoded = ''.force_encoding(BINARY)) ⇒ String
Get the symbol as a BSON key name encoded C symbol.
57 58 59 |
# File 'lib/bson/symbol.rb', line 57 def to_bson_key(encoded = ''.force_encoding(BINARY)) to_s.to_bson_key(encoded) end |
#to_bson_normalized_key ⇒ String
Converts the symbol to a normalized key in a BSON document.
69 70 71 |
# File 'lib/bson/symbol.rb', line 69 def to_bson_normalized_key to_s end |