Sha256: a953f6990794b14ee9ad6a9d1bd4e15ffeeda4fc588031a0f913f24ecfcadddc

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

module Rack::App::SingletonMethods::HttpMethods

  protected

  def get(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::GET, path, &block)
  end

  def post(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::POST, path, &block)
  end

  def put(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::PUT, path, &block)
  end

  def delete(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::DELETE, path, &block)
  end

  def head(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::HEAD, path, &block)
  end

  def options(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::OPTIONS, path, &block)
  end

  def patch(path = '/', &block)
    add_route(::Rack::App::Constants::HTTP::PATCH, path, &block)
  end

  def alias_endpoint(new_request_path, original_request_path)
    new_request_path = Rack::App::Utils.normalize_path(new_request_path)
    original_request_path = Rack::App::Utils.normalize_path(original_request_path)

    router.endpoints.select { |ep| ep[:request_path] == original_request_path }.each do |endpoint|
      router.register_endpoint!(endpoint[:request_method], new_request_path, endpoint[:description], endpoint[:endpoint])
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rack-app-3.6.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.5.2 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.5.1 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.5.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.4.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.3.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.2.1 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.2.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.1.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.0.0 lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.0.0.delta lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.0.0.gamma lib/rack/app/singleton_methods/http_methods.rb
rack-app-3.0.0.beta lib/rack/app/singleton_methods/http_methods.rb