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, include_private = false) ⇒ 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.
144 145 146 147 |
# File 'lib/bson/regexp.rb', line 144 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)
161 162 163 164 |
# File 'lib/bson/regexp.rb', line 161 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.
121 122 123 |
# File 'lib/bson/regexp.rb', line 121 def @options end |
#pattern ⇒ String (readonly)
Returns pattern The regex pattern.
118 119 120 |
# File 'lib/bson/regexp.rb', line 118 def pattern @pattern end |
Instance Method Details
#compile ⇒ ::Regexp
Compile the Regular expression into the native type.
131 132 133 |
# File 'lib/bson/regexp.rb', line 131 def compile @compiled ||= ::Regexp.new(pattern, ) end |
#respond_to?(method, include_private = false) ⇒ Boolean
Allow automatic delegation of methods to the Regexp object returned by compile
.
155 156 157 |
# File 'lib/bson/regexp.rb', line 155 def respond_to?(method, include_private = false) compile.respond_to?(method, include_private = false) || super end |