Module: Moped::BSON::Extensions::Regexp

Included in:
Regexp
Defined in:
lib/moped/bson/extensions/regexp.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__bson_dump__(io, key) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/moped/bson/extensions/regexp.rb', line 25

def __bson_dump__(io, key)
  io << Types::REGEX
  io << key.to_bson_cstring

  io << source.to_bson_cstring

  io << 'i'  if (options & ::Regexp::IGNORECASE) != 0
  io << 'ms' if (options & ::Regexp::MULTILINE) != 0
  io << 'x'  if (options & ::Regexp::EXTENDED) != 0
  io << NULL_BYTE
end