module Xenon::Routing::MethodDirectives

Public Instance Methods

get() { || ... } click to toggle source
# File lib/xenon/routing/method_directives.rb, line 18
def get
  request_method :get, :head do
    yield
  end
end
request_method(*methods) { || ... } click to toggle source
# File lib/xenon/routing/method_directives.rb, line 8
def request_method(*methods)
  extract_request do |request|
    if methods.include?(request.request_method)
      yield
    else
      reject Rejection.new(:method, { supported: methods })
    end
  end
end