class BSON::Regexp::Raw

Represents the raw values for the regular expression.

@see jira.mongodb.org/browse/RUBY-698

@since 3.0.0

Attributes

options[R]

@return [ Integer ] options The options.

pattern[R]

@return [ String ] pattern The regex pattern.

Public Class Methods

new(pattern, options) click to toggle source

Initialize the new raw regular expression.

@example Initialize the raw regexp.

Raw.new(pattern, options)

@param [ String ] pattern The regular expression pattern. @param [ Integer ] options The options.

@since 3.0.0

# File lib/bson/regexp.rb, line 144
def initialize(pattern, options)
  @pattern = pattern
  @options = options
end

Public Instance Methods

compile() click to toggle source

Compile the Regular expression into the native type.

@example Compile the regular expression.

raw.compile

@return [ ::Regexp ] The compiled regular expression.

@since 3.0.0

# File lib/bson/regexp.rb, line 131
def compile
  @compiled ||= ::Regexp.new(pattern, options)
end
respond_to?(method, include_private = false) click to toggle source

Allow automatic delegation of methods to the Regexp object returned by compile.

@param [ String] method The name of a method.

@since 3.1.0

Calls superclass method
# File lib/bson/regexp.rb, line 155
def respond_to?(method, include_private = false)
  compile.respond_to?(method, include_private = false) || super
end

Private Instance Methods

method_missing(method, *arguments) click to toggle source
Calls superclass method
# File lib/bson/regexp.rb, line 161
def method_missing(method, *arguments)
  return super unless respond_to?(method)
  compile.send(method, *arguments)
end