class BSON::Regexp::Raw

def as_extended_json(**opts)

Returns:
  • (Hash) - The extended json representation.

Options Hash: (**opts)
  • :mode (nil | :relaxed | :legacy) -- Serialization mode
def as_extended_json(**opts)
  if opts[:mode] == :legacy
    { '$regex' => source, '$options' => options }
  else
    { '$regularExpression' => { 'pattern' => source, 'options' => options } }
  end
end