espresso/espresso — pull request #65 by seamusabshere (2013-04-03 22:09:10+00:00)
Title: ensure that defining String#to_regexp won't break routing

Tests included.

Arguably the most natural way to define `String#to_regexp` is

"/hi/".to_regexp #=> /hi/
"/../".to_regexp #=> /../

If a user defines `String#to_regexp` in this way or requires the [`to_regexp` gem](https://github.com/seamusabshere/to_regexp), then `EspressoUtils.rootify_url(k)` will fail.

Simply calling `Regexp.escape` on the path modifiers prevents this, so that's what this pull request does. It also makes the function a bit more efficient.

(per https://github.com/seamusabshere/to_regexp/issues/2)