Deserialize the regular expression from BSON.
@param [ BSON ] bson The bson representing a regular expression.
@return [ Regexp ] The decoded regular expression.
@see bsonspec.org/#/specification
@since 2.0.0
# File lib/bson/regexp.rb, line 95 def from_bson(bson) pattern = bson.gets(NULL_BYTE).from_bson_string.chop! options = 0 while (option = bson.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(pattern, options) end
Generated with the Darkfish Rdoc Generator 2.