Skip to content

Instantly share code, notes, and snippets.

@cypher
Created August 4, 2009 12:05
Show Gist options
  • Save cypher/161172 to your computer and use it in GitHub Desktop.
Save cypher/161172 to your computer and use it in GitHub Desktop.
# Define a handler for multiple http verbs at once
def any(url, verbs = %w(get post put delete), &block)
verbs.each do |verb|
send(verb, url, &block)
end
end
any '/url' do
# ...
"return value"
end
any '/other_url', %w(get post) do
# ...
end
# Hat-tip to harryv for better names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment