Skip to content

Instantly share code, notes, and snippets.

@kgrz
Last active July 3, 2017 18:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgrz/10020524 to your computer and use it in GitHub Desktop.
Save kgrz/10020524 to your computer and use it in GitHub Desktop.
Sinatra's regex routing and captures block example
require "sinatra"
get %r{/([\w]+)/foo} do |bar|
puts bar
end
require "sinatra"
get %r{/([\w]+)/foo} do
params[:captures]
end
@farrellit
Copy link

ah, convenient :P Seeing the output would be even more convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment