avoid parsing the path twice in sinatra extension