class Padrino::Router

def map(options={})

def map(options={})
  path = options[:path] || "/"
  host = options[:host]
  app  = options[:to]
  raise ArgumentError, "paths need to start with /" if path[0] != ?/
  raise ArgumentError, "app is required" if app.nil?
  path  = path.chomp('/')
  match = Regexp.new("^#{Regexp.quote(path).gsub('/', '/+')}(.*)", nil, 'n')
  host  = Regexp.new("^#{Regexp.quote(host)}$", true, 'n') unless host.nil? || host.is_a?(Regexp)
  @mapping << [host, path, match, app]
  sort!
end