Module: BSON::Regexp::ClassMethods
- Defined in:
- lib/bson/regexp.rb
Overview
Instance Method Summary collapse
-
#from_bson(bson) ⇒ Regexp
Deserialize the regular expression from BSON.
Instance Method Details
#from_bson(bson) ⇒ Regexp
Deserialize the regular expression from BSON.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/bson/regexp.rb', line 153 def from_bson(bson) pattern = bson.gets(NULL_BYTE).from_bson_string.chop! = 0 while (option = bson.readbyte) != 0 case option when 105 # 'i' |= ::Regexp::IGNORECASE when 109, 115 # 'm', 's' |= ::Regexp::MULTILINE when 120 # 'x' |= ::Regexp::EXTENDED end end Raw.new(pattern, ) end |