Module: BSON::Symbol::ClassMethods

Defined in:
lib/bson/symbol.rb

Overview

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#from_bson(buffer, **options) ⇒ Symbol | BSON::Symbol::Raw

Deserialize a symbol from BSON.

Parameters:

  • buffer (ByteBuffer)

    The byte buffer.

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :mode (nil | :bson)

    Decoding mode to use.

Returns:

See Also:

Since:

  • 2.0.0



190
191
192
193
194
195
196
197
198
# File 'lib/bson/symbol.rb', line 190

def from_bson(buffer, **options)
  sym = buffer.get_string.intern

  if options[:mode] == :bson
    Raw.new(sym)
  else
    sym
  end
end