lib/roda/plugins/hash_routes.rb
# Setup a path in the current namespace for the given request method verb.
# Returns 404 for requests for the path with a different request method.
Setup a path in the current namespace for the given request method verb.
Returns 404 for requests for the path with a different request method.
Setup a path in the current namespace for the given request method verb . Returns 404 for requests for the path with a different request method .
def verb(verb, path, &block)
          path = path == true ? "" : "/#{path}"
          meth_hash = @roda.opts[:hash_routes_methods]
          key = [@namespace, path].freeze
          meth = meth_hash[key] = @roda.define_roda_method(meth_hash[key] || "hash_routes_#{@namespace}_#{path}", 0, &block)
          @roda.hash_path(@namespace, path) do |r|
            r.send(verb) do
              send(meth)
            end
          end
        end
def verb ( verb , path , & block ) path = path == true ? "" : "/#{path}" meth_hash = @roda . opts [ :hash_routes_methods ] key = [ @namespace , path ] . freeze meth = meth_hash [ key ] = @roda . define_roda_method ( meth_hash [ key ] || "hash_routes_#{@namespace}_#{path}" , 0 , & block ) @roda . hash_path ( @namespace , path ) do | r | r . send ( verb ) do send ( meth ) end end end
Setup a path in the current namespace for the given request method verb.
Setup a path in the current namespace for the given request method verb .
verb
path
block