Skip to content

Instantly share code, notes, and snippets.

@DanielVartanov
Created August 28, 2010 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielVartanov/554909 to your computer and use it in GitHub Desktop.
Save DanielVartanov/554909 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'http_router'
require 'http_router/interface/sinatra'
class Application < Sinatra::Base
register HttpRouter::Interface::Sinatra::Extension
params_inspect = lambda { params.inspect + "\n" }
# These routes will work
get("/:common_variable/:matched", :matching => { :matched => /abcde/ }, &params_inspect)
get("/:common_variable/:unmatched", &params_inspect)
# These routes will NOT work (just because of alternative delimiter)
get("/:common_variable\\(:matched", :matching => { :matched => /abcde/ }, &params_inspect)
get("/:common_variable\\(:unmatched", &params_inspect)
get("/:common_variable.:matched", :matching => { :matched => /abcde/ }, &params_inspect)
get("/:common_variable.:unmatched", &params_inspect)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment