Class: BSON::Regexp::Raw

Inherits:
Object
  • Object
show all
Defined in:
lib/bson/regexp.rb

Overview

Represents the raw values for the regular expression.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, options) ⇒ Raw

Initialize the new raw regular expression.

Examples:

Initialize the raw regexp.

Raw.new(pattern, options)

Parameters:

  • pattern (String)

    The regular expression pattern.

  • options (Integer)

    The options.

Since:

  • 3.0.0



119
120
121
122
# File 'lib/bson/regexp.rb', line 119

def initialize(pattern, options)
  @pattern = pattern
  @options = options
end

Instance Attribute Details

#optionsInteger (readonly)

Returns options The options.

Returns:

  • (Integer)

    options The options.

Since:

  • 3.0.0



96
97
98
# File 'lib/bson/regexp.rb', line 96

def options
  @options
end

#patternString (readonly)

Returns pattern The regex pattern.

Returns:

  • (String)

    pattern The regex pattern.

Since:

  • 3.0.0



93
94
95
# File 'lib/bson/regexp.rb', line 93

def pattern
  @pattern
end

Instance Method Details

#compile::Regexp

Compile the Regular expression into the native type.

Examples:

Compile the regular expression.

raw.compile

Returns:

  • (::Regexp)

    The compiled regular expression.

Since:

  • 3.0.0



106
107
108
# File 'lib/bson/regexp.rb', line 106

def compile
  @compiled ||= ::Regexp.new(pattern, options)
end