module Roda::RodaPlugins::PathRewriter::ClassMethods

def freeze

Freeze the path rewrite metadata.
def freeze
  opts[:remaining_path_rewrites].freeze
  opts[:path_info_rewrites].freeze
  super
end

def rewrite_path(was, is = nil, opts=OPTS, &block)

:path_info :: Modify PATH_INFO, not just remaining path.
Record a path rewrite from path +was+ to path +is+. Options:
def rewrite_path(was, is = nil, opts=OPTS, &block)
  if is.is_a? Hash
    raise RodaError, "cannot provide two hashes to rewrite_path" unless opts.empty?
    opts = is
    is = nil
  end
  if block
    raise RodaError, "cannot provide both block and string replacement to rewrite_path" if is
    is = block
  end
  was = /\A#{Regexp.escape(was)}/ unless was.is_a?(Regexp)
  array = @opts[opts[:path_info] ? :path_info_rewrites : :remaining_path_rewrites]
  array << [was, is.dup.freeze].freeze
end