module BSON::Regexp::ClassMethods
Class-level methods to be added to the Regexp
class.
Public Instance Methods
from_bson(buffer, **_)
click to toggle source
Deserialize the regular expression from BSON
.
@note If the argument cannot be parsed, an exception will be raised
and the argument will be left in an undefined state. The caller must explicitly call `rewind` on the buffer before trying to parse it again.
@param [ ByteBuffer
] buffer The byte buffer.
@option opts [ nil | :bson ] :mode Decoding mode to use.
@return [ Regexp
] The decoded regular expression.
@see bsonspec.org/#/specification
# File lib/bson/regexp.rb, line 265 def from_bson(buffer, **_) pattern = buffer.get_cstring options = buffer.get_cstring Raw.new(pattern, options) end