Module: Moped::BSON::Extensions::Symbol

Included in:
Symbol
Defined in:
lib/moped/bson/extensions/symbol.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__bson_dump__(io, key) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/moped/bson/extensions/symbol.rb', line 7

def __bson_dump__(io, key)
  io << Types::SYMBOL
  io << key.to_bson_cstring
  data = to_utf8_binary
  io << [ data.bytesize + 1 ].pack(INT32_PACK)
  io << data
  io << NULL_BYTE
end

#to_bson_cstringObject



16
17
18
# File 'lib/moped/bson/extensions/symbol.rb', line 16

def to_bson_cstring
  to_s.to_bson_cstring
end

#to_utf8_binaryObject



20
21
22
# File 'lib/moped/bson/extensions/symbol.rb', line 20

def to_utf8_binary
  to_s.to_utf8_binary
end