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



12
13
14
15
16
17
18
19
20
21
# File 'lib/moped/bson/extensions/symbol.rb', line 12

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



23
24
25
# File 'lib/moped/bson/extensions/symbol.rb', line 23

def to_bson_cstring
  to_s.to_bson_cstring
end

#to_utf8_binaryObject



27
28
29
# File 'lib/moped/bson/extensions/symbol.rb', line 27

def to_utf8_binary
  to_s.to_utf8_binary
end