class RewriteCond

Public Class Methods

new(line) click to toggle source
# File lib/rewrite_cond.rb, line 4
def initialize(line)
  @line = line
  self.parse line

  raise InvalidRule.new unless valid?
end

Public Instance Methods

parse(line) click to toggle source
# File lib/rewrite_cond.rb, line 11
def parse(line)
  match_data = /RewriteCond[ ]+([^ ]+)[ ]+([^ ]+)([ ]+\[([^ ]+)\]\n?)?$/.match(line)

  return if match_data.nil?

  @expression = match_data[1]
  @compare = match_data[2]
  @flags = match_data[4].nil? ? nil : match_data[4].split(',')
end
valid?() click to toggle source
# File lib/rewrite_cond.rb, line 21
def valid?
  !@expression.nil? && !@compare.nil?
end