Sha256: 8ddf9cc2bd1ee016edd7ce0be005e97c62d6edb3f6608f3cb66c4ca7275386e5

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

require_relative "../http_route"
require_relative "common"

module Lita
  class Handler
    # A handler mixin that provides the methods necessary for handling incoming HTTP requests.
    # @since 4.0.0
    module HTTPRouter
      # Includes common handler methods in any class that includes {HTTPRouter}.
      def self.extended(klass)
        klass.include(Common)
      end

      # Creates a new {HTTPRoute} which is used to define an HTTP route
      # for the built-in web server.
      # @see HTTPRoute
      # @return [HTTPRoute] The new {HTTPRoute}.
      def http
        HTTPRoute.new(self)
      end

      # An array of all HTTP routes defined for the handler.
      # @return [Array<HTTPRoute>] The array of routes.
      def http_routes
        @http_routes ||= []
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rita-5.0.0.alpha.4 lib/lita/handler/http_router.rb
rita-5.0.0.alpha.3 lib/lita/handler/http_router.rb
rita-5.0.0.alpha.2 lib/lita/handler/http_router.rb
rita-5.0.0.alpha.1 lib/lita/handler/http_router.rb