Skip to content

Instantly share code, notes, and snippets.

@technoweenie
Created April 27, 2011 12:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save technoweenie/e73ef466841e7769b48e to your computer and use it in GitHub Desktop.
Save technoweenie/e73ef466841e7769b48e to your computer and use it in GitHub Desktop.
module Api::HttpMethods
def verbs(*methods, &bk)
opts = methods.last.is_a?(Hash) ? methods.pop : {}
path = methods.pop
conditions = @conditions.dup
methods.each do |method|
@conditions = conditions
route(method.to_s.upcase, path, opts, &bk)
end
end
end
class SuperRESTApp < Sinatra::Base
register Api::HttpMethods
verbs :patch, :post, '/:id' do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment