Last active
July 3, 2017 18:37
-
-
Save kgrz/10020524 to your computer and use it in GitHub Desktop.
Sinatra's regex routing and captures block example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sinatra" | |
get %r{/([\w]+)/foo} do |bar| | |
puts bar | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sinatra" | |
get %r{/([\w]+)/foo} do | |
params[:captures] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ah, convenient :P Seeing the output would be even more convenient.