module ActionDispatch::Routing::Mapper::HttpHelpers

def connect(*args, &block)

connect 'live', to: 'live#index'

see [match](rdoc-ref:Base#match)
CONNECT requests with the protocol pseudo header. For supported arguments,
specifically this recognizes HTTP/1 protocol upgrade requests and HTTP/2
Define a route that recognizes HTTP CONNECT (and GET) requests. More
def connect(*args, &block)
  map_method([:get, :connect], args, &block)
end

def delete(*args, &block)

delete 'broccoli', to: 'food#broccoli'

[match](rdoc-ref:Base#match)
Define a route that only recognizes HTTP DELETE. For supported arguments, see
def delete(*args, &block)
  map_method(:delete, args, &block)
end

def get(*args, &block)

get 'bacon', to: 'food#bacon'

[match](rdoc-ref:Base#match)
Define a route that only recognizes HTTP GET. For supported arguments, see
def get(*args, &block)
  map_method(:get, args, &block)
end

def map_method(method, args, &block)

def map_method(method, args, &block)
  options = args.extract_options!
  options[:via] = method
  match(*args, options, &block)
  self
end

def options(*args, &block)

options 'carrots', to: 'food#carrots'

[match](rdoc-ref:Base#match)
Define a route that only recognizes HTTP OPTIONS. For supported arguments, see
def options(*args, &block)
  map_method(:options, args, &block)
end

def patch(*args, &block)

patch 'bacon', to: 'food#bacon'

[match](rdoc-ref:Base#match)
Define a route that only recognizes HTTP PATCH. For supported arguments, see
def patch(*args, &block)
  map_method(:patch, args, &block)
end

def post(*args, &block)

post 'bacon', to: 'food#bacon'

[match](rdoc-ref:Base#match)
Define a route that only recognizes HTTP POST. For supported arguments, see
def post(*args, &block)
  map_method(:post, args, &block)
end

def put(*args, &block)

put 'bacon', to: 'food#bacon'

[match](rdoc-ref:Base#match)
Define a route that only recognizes HTTP PUT. For supported arguments, see
def put(*args, &block)
  map_method(:put, args, &block)
end