Module: Apache::RegularExpressionMatcher
- Included in:
- RedirectMatchPermanent, RewriteCondition, RewriteRule
- Defined in:
- lib/apache/rewrites.rb
Overview
Common methods for testing rewritable things that use regular expressions
Instance Method Summary collapse
- #match?(from, opts = {}) ⇒ Boolean
-
#test(from, opts = {}) ⇒ Object
Test this rewritable thing.
Instance Method Details
#match?(from, opts = {}) ⇒ Boolean
181 182 183 |
# File 'lib/apache/rewrites.rb', line 181 def match?(from, opts = {}) from.replace_placeholderize(opts)[@from] end |
#test(from, opts = {}) ⇒ Object
Test this rewritable thing
177 178 179 |
# File 'lib/apache/rewrites.rb', line 177 def test(from, opts = {}) from.gsub(@from, @to.gsub(/\$([0-9])/) { |match| '\\' + $1 }).replace_placeholderize(opts) end |