def new(req_path_pattern, replace_location, status)
if (! req_path_pattern) then
raise 'required request path pattern.'
end
if (! replace_location || replace_location.empty?) then
raise 'required replace location.'
end
case (status)
when '302 Found'
code = 302
when '303 See Other'
code = 303
when '301 Moved Permanently'
code = 301
when '307 Temporary Redirect'
code = 307
else
raise "unknown redirect status: #{status.inspect}"
end
RegexpRedirectDocument.new(req_path_pattern, replace_location, status)
end