Class: Mongo::RegexpOfHolding Deprecated

Inherits:
Regexp
  • Object
show all
Defined in:
lib/mongo/types/regexp_of_holding.rb

Overview

Deprecated.

A Regexp that can hold on to extra options and ignore them. Mongo regexes may contain option characters beyond ‘i’, ‘m’, and ‘x’. (Note that Mongo only uses those three, but that regexes coming from other languages may store different option characters.)

Note that you do not have to use this class at all if you wish to store regular expressions in Mongo. The Mongo and Ruby regex option flags are the same. Storing regexes is discouraged, in any case.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, options, extra_options_str) ⇒ RegexpOfHolding

Deprecated.

we’re no longer supporting this.

str and options are the same as Regexp. extra_options_str contains all the other flags that were in Mongo but we do not use or understand.



37
38
39
40
41
42
# File 'lib/mongo/types/regexp_of_holding.rb', line 37

def initialize(str, options, extra_options_str)
  warn "RegexpOfHolding is deprecated; the modifiers i, m, and x will be stored automatically as BSON." +
    "If you're only storing the options i, m, and x, you can safely ignore this message."
  super(str, options)
  @extra_options_str = extra_options_str
end

Instance Attribute Details

#extra_options_strObject

Returns the value of attribute extra_options_str.



31
32
33
# File 'lib/mongo/types/regexp_of_holding.rb', line 31

def extra_options_str
  @extra_options_str
end