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

Instance Method Details

#match?(from, opts = {}) ⇒ Boolean

Returns:

  • (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