Method: BSON::Regexp::Raw#to_bson
- Defined in:
- lib/bson/regexp.rb
#to_bson(buffer = ByteBuffer.new) ⇒ BSON::ByteBuffer
Note:
From the BSON spec: The first cstring is the regex pattern, the second is the regex options string. Options are identified by characters, which must be stored in alphabetical order. Valid options are ‘i’ for case insensitive matching, ‘m’ for multiline matching, ‘x’ for verbose mode, ‘l’ to make w, W, etc. locale dependent, ‘s’ for dotall mode (‘.’ matches everything), and ‘u’ to make w, W, etc. match unicode.
Encode the Raw Regexp object to BSON.
187 188 189 190 |
# File 'lib/bson/regexp.rb', line 187 def to_bson(buffer = ByteBuffer.new) buffer.put_cstring(source) buffer.put_cstring(.chars.sort.join) end |