module Moped::BSON::Extensions::Regexp::ClassMethods

Public Instance Methods

__bson_load__(io) click to toggle source
# File lib/moped/bson/extensions/regexp.rb, line 19
def __bson_load__(io)
  source = io.gets(NULL_BYTE).from_utf8_binary.chop!
  options = 0
  while (option = io.readbyte) != 0
    case option
    when 105 # 'i'
      options |= ::Regexp::IGNORECASE
    when 109, 115 # 'm', 's'
      options |= ::Regexp::MULTILINE
    when 120 # 'x'
      options |= ::Regexp::EXTENDED
    end
  end
  new(source, options)
end