lib/roda/plugins/all_verbs.rb in roda-0.9.0 vs lib/roda/plugins/all_verbs.rb in roda-1.0.0

- old
+ new

@@ -14,11 +14,11 @@ # Example: # # plugin :all_verbs # # route do |r| - # r.delete + # r.delete do # # Handle DELETE # end # r.put do # # Handle PUT # end @@ -28,17 +28,15 @@ # end # # The verb methods are defined via metaprogramming, so there # isn't documentation for the individual methods created. module AllVerbs - module RequestMethods - %w'delete head options link patch put trace unlink'.each do |t| - if ::Rack::Request.method_defined?("#{t}?") - class_eval(<<-END, __FILE__, __LINE__+1) - def #{t}(*args, &block) - is_or_on(*args, &block) if #{t}? - end - END + def self.configure(app) + %w'delete head options link patch put trace unlink'.each do |v| + if ::Rack::Request.method_defined?("#{v}?") + app.request_module do + app::RodaRequest.def_verb_method(self, v) + end end end end end