Sha256: 6d2f65128f1e9ce575eed3aa32570fb4af4d46c50d9f3d12dcb296af18ca794b

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module RapidRunty
  class Application
    # Retrieve the controller and action method from the URL
    #
    # @param env [Hash] Rack environment Hash that includes CGI-like headers
    #
    # @return [Controller, Action] array
    def get_controller_action(env)
      _, controller, action, _other = env["PATH_INFO"].split("/", 4)
      controller = controller.capitalize
      controller += "Controller"

      # Lookup controller constant name and return [controller, action]
      [Object.const_get(controller), action]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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