Sha256: 0ceb4695a208331e71cc1343e781c7ada6f3a5f854b308213ccaf3841871c120

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

require "rapid_runty/routing"
require "rapid_runty/controller"

module RapidRunty
  # Main framework Application class. Entry point for all requests.
  #
  # Example:
  #
  #   class Application < RapidRunty::Application
  #   end
  class Application
    ##
    # Returns a rack compatible response.
    #
    # Retrieves the controller and action from request URL making a new
    # controller and send it to the action.
    #
    # @param env [Hash] Rack environment Hash that includes CGI-like headers
    #
    # @return [status, {headers}, [response]] array
    def call(env)
      return [500, {}, []] if env["PATH_INFO"] == "/favicon.ico"
      controller_class, action = get_controller_action(env)
      controller = controller_class.new(env)
      response = controller.send(action)
      [200, { "Content-Type" => "text/html" }, [response]]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapid_runty-0.1.1 lib/rapid_runty/application.rb