Class: BSON::Regexp::Raw
- Inherits:
-
Object
- Object
- BSON::Regexp::Raw
- Defined in:
- lib/bson/regexp.rb
Overview
Represents the raw values for the regular expression.
Instance Attribute Summary collapse
-
#options ⇒ Integer
readonly
Options The options.
-
#pattern ⇒ String
readonly
Pattern The regex pattern.
Instance Method Summary collapse
-
#compile ⇒ ::Regexp
Compile the Regular expression into the native type.
-
#initialize(pattern, options) ⇒ Raw
constructor
Initialize the new raw regular expression.
-
#respond_to?(method) ⇒ Boolean
Allow automatic delegation of methods to the Regexp object returned by
compile
.
Constructor Details
#initialize(pattern, options) ⇒ Raw
Initialize the new raw regular expression.
119 120 121 122 |
# File 'lib/bson/regexp.rb', line 119 def initialize(pattern, ) @pattern = pattern @options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments) ⇒ Object (private)
136 137 138 139 |
# File 'lib/bson/regexp.rb', line 136 def method_missing(method, *arguments) return super unless respond_to?(method) compile.send(method, *arguments) end |
Instance Attribute Details
#options ⇒ Integer (readonly)
Returns options The options.
96 97 98 |
# File 'lib/bson/regexp.rb', line 96 def @options end |
#pattern ⇒ String (readonly)
Returns pattern The regex pattern.
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.
106 107 108 |
# File 'lib/bson/regexp.rb', line 106 def compile @compiled ||= ::Regexp.new(pattern, ) end |
#respond_to?(method) ⇒ Boolean
Allow automatic delegation of methods to the Regexp object returned by compile
.
130 131 132 |
# File 'lib/bson/regexp.rb', line 130 def respond_to?(method) compile.respond_to?(method) || super end |